BincodeSend

Trait BincodeSend 

Source
pub trait BincodeSend: Unpin + Sized {
    // Required methods
    fn push<T>(&mut self, message: T) -> impl Future<Output = Void>
       where T: Encode;
    fn close(&mut self) -> impl Future<Output = Void>;
}
Expand description

A trait for sending protocol messages over a stream.

This impl is designed to ensure that the push method can only be used to send ProtocolMessage messages. This restriction is important for type safety and to ensure that all messages sent through the stream follow the protocol format and are properly encrypted if necessary.

Required Methods§

Source

fn push<T>(&mut self, message: T) -> impl Future<Output = Void>
where T: Encode,

Pushes a message to the stream.

Right now, this only requires T: Encode, but in the future, it may require a concrete type, such as ProtocolMessage.

Source

fn close(&mut self) -> impl Future<Output = Void>

Closes the stream via shutdown.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§