Skip to main content

MarshalSize

Trait MarshalSize 

Source
pub trait MarshalSize: Send + Sync {
    // Required method
    fn marshal_size(&self) -> usize;
}
Expand description

The encoded size of a value, in bytes.

Implemented alongside Marshal/Unmarshal so a caller can size a buffer before encoding, and so nested codecs can compute offsets without encoding twice.

Required Methods§

Source

fn marshal_size(&self) -> usize

The number of bytes Marshal::marshal_to will write for this value.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§