Trait EncodableSize

Source
pub trait EncodableSize: Encodable<SizeEncoder> {
    // Required method
    fn encoded_size(&self) -> Result<usize, Self::Error>;
}
Expand description

An extension trait for types that can calculate the size of their encoded form.

This trait is implemented for all types that implement the Encodable trait for SizeEncoder.

See the SizeEncoder encoder for more information.

Required Methods§

Source

fn encoded_size(&self) -> Result<usize, Self::Error>

Returns the size of the encoded form of self.

§Errors

If encoding fails, this method will return an error.

Implementors§