[][src]Trait grammers_mtproto::transports::Decoder

pub trait Decoder {
    fn read<'a>(&mut self, input: &'a [u8]) -> Result<&'a [u8], TransportError>;
}

The trait used by the decoder part of a concrete transport.

Required methods

fn read<'a>(&mut self, input: &'a [u8]) -> Result<&'a [u8], TransportError>

Read a packet from input and return the body subslice.

On success, return how many bytes were written.

On failure, return either how many bytes long the input buffer should have been or decoding failure in which case the connection should end.

Loading content...

Implementors

Loading content...