pub trait Encode {
// Required methods
fn size(&self) -> Size;
fn encode(&self, encoder: &mut Encoder<'_>);
}Expand description
Represents an encodable type.
Required Methods§
Sourcefn encode(&self, encoder: &mut Encoder<'_>)
fn encode(&self, encoder: &mut Encoder<'_>)
Writes the type’s data to the specified encoder.
§Notes
Encoding values that do not match what is returned by Encode::size
may cause the encoding to panic.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".