[−][src]Trait grammers_mtproto::transports::Encoder
The trait used by the encoder part of a concrete transport.
Required methods
fn max_overhead(&self) -> usize
How much overhead does the transport incur, at a maximum.
fn write_magic(&mut self, output: &mut [u8]) -> Result<usize, usize>
Write the protocol's magic into output
.
On success, return how many bytes were written.
On failure, return how many bytes long the output buffer should have been.
fn write_into<'a>(
&mut self,
input: &[u8],
output: &mut [u8]
) -> Result<usize, usize>
&mut self,
input: &[u8],
output: &mut [u8]
) -> Result<usize, usize>
Write the packet from input
into output
.
On success, return how many bytes were written.
On failure, return how many bytes long the output buffer should have been.
Panics
The input length must be a multiple of 4, or else a panic will occur.