pub trait ProtocolConnection {
type Packet;
// Required methods
fn read_packet(
&mut self,
) -> impl Future<Output = Result<Self::Packet>> + Send;
fn write_packet(
&mut self,
packet: &Self::Packet,
) -> impl Future<Output = Result<()>> + Send;
fn enable_encryption(&mut self, key: &[u8], iv: &[u8]) -> Result<()>;
fn enable_compression(&mut self, threshold: i32);
fn close(&mut self) -> impl Future<Output = Result<()>> + Send;
}
Expand description
Trait for abstracting a network connection with protocol capabilities
Required Associated Types§
Required Methods§
fn read_packet(&mut self) -> impl Future<Output = Result<Self::Packet>> + Send
fn write_packet( &mut self, packet: &Self::Packet, ) -> impl Future<Output = Result<()>> + Send
fn enable_encryption(&mut self, key: &[u8], iv: &[u8]) -> Result<()>
fn enable_compression(&mut self, threshold: i32)
fn close(&mut self) -> impl Future<Output = Result<()>> + Send
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.