pub trait ChannelBinder: Send + Sync {
// Required methods
fn create_tx(
&self,
initial_credit: u32,
) -> (ChannelId, Arc<dyn ChannelSink>);
fn create_rx(&self) -> (ChannelId, Receiver<IncomingChannelMessage>);
fn bind_tx(
&self,
channel_id: ChannelId,
initial_credit: u32,
) -> Arc<dyn ChannelSink>;
fn register_rx(
&self,
channel_id: ChannelId,
) -> Receiver<IncomingChannelMessage>;
}Expand description
Trait for channel operations, implemented by the session driver.
This abstraction lets the binding functions and macro-generated code bind channels without depending on concrete driver types.
Required Methods§
Sourcefn create_tx(&self, initial_credit: u32) -> (ChannelId, Arc<dyn ChannelSink>)
fn create_tx(&self, initial_credit: u32) -> (ChannelId, Arc<dyn ChannelSink>)
Allocate a channel ID and create a sink for sending items.
initial_credit is the const generic N from Tx<T, N> or Rx<T, N>.
Sourcefn create_rx(&self) -> (ChannelId, Receiver<IncomingChannelMessage>)
fn create_rx(&self) -> (ChannelId, Receiver<IncomingChannelMessage>)
Allocate a channel ID, register it for routing, and return a receiver.
Sourcefn bind_tx(
&self,
channel_id: ChannelId,
initial_credit: u32,
) -> Arc<dyn ChannelSink>
fn bind_tx( &self, channel_id: ChannelId, initial_credit: u32, ) -> Arc<dyn ChannelSink>
Create a sink for a known channel ID (callee side).
The channel ID comes from Request.channels.
initial_credit is the const generic N from Tx<T, N>.
Sourcefn register_rx(&self, channel_id: ChannelId) -> Receiver<IncomingChannelMessage>
fn register_rx(&self, channel_id: ChannelId) -> Receiver<IncomingChannelMessage>
Register an inbound channel by ID and return the receiver (callee side).
The channel ID comes from Request.channels.