pub trait TcpMessage<'a, M, C> where
    Self: Default,
    M: MetaDataType<'a, M, C>,
    C: ContentType<'a, M, C>, 
{ fn destructure(self) -> (M, C, Packet); fn build(metadata: M, content: C, end_data: Packet) -> Self; fn send(
        self,
        stream: &mut TcpStream,
        context: Option<<M as MetaDataType<'a, M, C>>::SendContext>
    ) -> Result<Option<<C as ContentType<'a, M, C>>::SendOutput>, Error> { ... } fn receive(
        stream: &mut TcpStream,
        context: Option<<M as MetaDataType<'a, M, C>>::ReceiveContext>
    ) -> Result<(Self, Option<<C as ContentType<'a, M, C>>::ReceiveOutput>), Error> { ... } }
Expand description

Trait that allows implementor to send and receive itself via TcpStream with provided TcpMessage::send and TcpMessage::receive.

Required Methods

Breaks self into metadata, content and end_data.

Builds Self from metadata, content and end_data.

Provided Methods

Sends Self via stream.

Returns an optional output which is ContentType::SendOutput on associated C if successful or an Error if not.

Arguments

This uses send methods implemented by metadata and content.

Receives a message on stream.

Returns a tuple of Self and an optional output which is ContentType::ReceiveOutput on associated C if successful or an Error if not.

Arguments

Implementors