pub trait SendProtocol {
type CustomErr: Debug + Send;
// Required methods
fn notify_from_recv(&mut self, event: ProtocolEvent);
fn send<'life0, 'async_trait>(
&'life0 mut self,
event: ProtocolEvent,
) -> Pin<Box<dyn Future<Output = Result<(), ProtocolError<Self::CustomErr>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn flush<'life0, 'async_trait>(
&'life0 mut self,
bandwidth: Bandwidth,
dt: Duration,
) -> Pin<Box<dyn Future<Output = Result<Bandwidth, ProtocolError<Self::CustomErr>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Generic Network Send Protocol.
Implement this for your Protocol of choice ( tcp, udp, mpsc, quic)
Allows the creation/deletions of Streams and sending messages via
ProtocolEvent.
A Stream MUST be bound to a specific Channel. You MUST NOT switch the
channel to send a stream mid air. We will provide takeover options for
Channel closure in the future to allow keeping a Stream over a broken
Channel.
Required Associated Types§
Required Methods§
Sourcefn notify_from_recv(&mut self, event: ProtocolEvent)
fn notify_from_recv(&mut self, event: ProtocolEvent)
YOU MUST inform the SendProtocol by any Stream Open BEFORE using it in
send and Stream Close AFTER using it in send via this fn.
Sourcefn send<'life0, 'async_trait>(
&'life0 mut self,
event: ProtocolEvent,
) -> Pin<Box<dyn Future<Output = Result<(), ProtocolError<Self::CustomErr>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 mut self,
event: ProtocolEvent,
) -> Pin<Box<dyn Future<Output = Result<(), ProtocolError<Self::CustomErr>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a Event via this Protocol. The SendProtocol MAY require flush
to be called before actual data is send to the respective Sink.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".