zer0-proto-mp · channel
Source declarations, signatures and documentation for channel.
Source: sigil/weave/libs/zer0-proto-mp/src/channel.rs. SHA-256: d98c92088d42c2d23bbf096e350721bd16010c602f202ba32fc6b4362f1e9a2a.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
channel::ChannelStats
Channel statistics
#[derive(Debug, Default)]
pub struct ChannelStats {
pub messages_sent: AtomicU64,
pub messages_received: AtomicU64,
pub bytes_sent: AtomicU64,
pub bytes_received: AtomicU64
}Source line: 15.
channel::ChannelMessage
Channel message types
#[derive(Debug)]
pub enum ChannelMessage {
Data {
message_id: MessageId,
data: Bytes,
},
Close,
/// Half-close this direction (no more sends)
HalfClose,
/// Abort the channel with an error string
Abort(String),
/// Grant receive credits to the remote side (bytes)
Credits(usize),
}Source line: 24.
channel::Channel
A multiplexed channel
#[derive(Clone)]
pub struct Channel {
}Source line: 70.
channel::Channel::id
Get channel ID
pub fn id(&self) -> ChannelId;Source line: 102.
channel::Channel::protocol
Get protocol reference
pub fn protocol(&self) -> &Protocol;Source line: 107.
channel::Channel::is_ready
Check if channel is ready for communication
pub async fn is_ready(&self) -> Result<bool>;Source line: 112.
channel::Channel::send
Send a message on this channel
pub async fn send(&self, message_id: MessageId, data: Bytes) -> Result<()>;Source line: 121.
channel::Channel::on_bytes_consumed
Replenish receive credits and surface a Credits frame through scheduler by emitting a ChannelMessage::Data with type Credits elsewhere (handled in mux)
pub fn on_bytes_consumed(&self, bytes: usize, cfg: &MuxConfig) -> Option<usize>;Source line: 152.
channel::Channel::try_consume_send_credit
Try to consume send credits; returns false if insufficient
pub fn try_consume_send_credit(&self, bytes: usize, cfg: &MuxConfig) -> bool;Source line: 167.
channel::Channel::half_close
Half-close this channel (constructs the variant for scheduler handling)
pub async fn half_close(&self) -> Result<()>;Source line: 180.
channel::Channel::abort
Abort this channel with a reason (constructs the variant for scheduler handling)
pub async fn abort(&self, reason: impl Into<String>) -> Result<()>;Source line: 192.
channel::Channel::recv
Receive is not wired in the minimal production pass; use ChannelHandle rx in mux for now
pub async fn recv(&self) -> Result<(MessageId, Bytes)>;Source line: 206.
channel::Channel::close
Close the channel
pub async fn close(&self) -> Result<()>;Source line: 211.
channel::Channel::stats
Get channel statistics
pub fn stats(&self) -> &ChannelStats;Source line: 228.
channel::ChannelHandle
Handle to a channel for external use
#[derive(Clone)]
pub struct ChannelHandle {
}Source line: 247.
channel::ChannelHandle::id
Get channel ID
pub fn id(&self) -> ChannelId;Source line: 258.
channel::ChannelHandle::send
Send a message
pub async fn send(&self, message_id: MessageId, data: impl Into<Bytes>) -> Result<()>;Source line: 263.
channel::ChannelHandle::recv
Receive a message
pub async fn recv(&self) -> Result<(MessageId, Bytes)>;Source line: 268.
channel::ChannelHandle::close
Close the channel
pub async fn close(&self) -> Result<()>;Source line: 273.
channel::ChannelHandle::is_ready
Check if channel is ready
pub async fn is_ready(&self) -> Result<bool>;Source line: 278.
channel::ChannelHandle::stats
Get channel statistics
pub fn stats(&self) -> &ChannelStats;Source line: 283.
channel::ChannelHandle::protocol
Get protocol reference
pub fn protocol(&self) -> &Protocol;Source line: 288.