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

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

Required Associated Types

Context provided to ContentType::send inside TcpMessage::send, created in MetaDataType::send.

Context provided to ContentType::receive inside TcpMessage::receive, created in MetaDataType::send.

Output of ContentType::send that is used as an output of TcpMessage::send.

Output of ContentType::receive that is used as an output of TcpMessage::receive.

Required Methods

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

Defines how content is send.

Returns an optional ContentType::SendOutput if successful or an Error if not.

Arguments

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

Defines how content are received.

Returns a tuple if successful or an Error if not.

Arguments

Implementors