Skip to main content

MetaDataType

Trait MetaDataType 

Source
pub trait MetaDataType<'a, M, C>
where Self: Sized, M: MetaDataType<'a, M, C>, C: ContentType<'a, M, C>,
{ type SendContext: ContextType; type ReceiveContext: ContextType; // Required methods fn send( self, stream: &mut TcpStream, context: Option<Self::SendContext>, ) -> Result<Option<<C as ContentType<'a, M, C>>::SendContext>, Error>; fn receive( stream: &mut TcpStream, context: &Option<Self::ReceiveContext>, ) -> Result<(Self, Option<<C as ContentType<'a, M, C>>::ReceiveContext>), Error>; }
Expand description

Trait that needs to be implemented for type that will be used as metadata inside a message.

Required Associated Types§

Required Methods§

Source

fn send( self, stream: &mut TcpStream, context: Option<Self::SendContext>, ) -> Result<Option<<C as ContentType<'a, M, C>>::SendContext>, Error>

Send method used to send metadata inside TcpMessage::send.

Defines how are metadata send.

Returns an Option of ContentType::SendContext on associated C that is passed into ContentType::send in TcpMessage::send. or an Error if not.

§Arguments
Source

fn receive( stream: &mut TcpStream, context: &Option<Self::ReceiveContext>, ) -> Result<(Self, Option<<C as ContentType<'a, M, C>>::ReceiveContext>), Error>

Receive method used to receive metadata inside TcpMessage::receive.

Defines how metadata are received.

Returns a tuple of Self and an Option of ContentType::ReceiveContext on associated C that is passed into ContentType::receive in TcpMessage::send if successful or an Error if not.

§Arguments

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§