pub trait EncodePlan {
// Required methods
fn encoded_len(&self) -> usize;
fn write_into(&self, output: &mut [u8]);
}Expand description
A completed, infallible encoding operation.
Implementations perform all fallible work while they are created. write_into
therefore only copies already-prepared bytes into an exactly-sized output slice.
Required Methods§
Sourcefn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Returns the exact number of bytes written by Self::write_into.
Sourcefn write_into(&self, output: &mut [u8])
fn write_into(&self, output: &mut [u8])
Writes this plan into output.
output must have length Self::encoded_len. Passing another length is a
contract violation and may panic; implementations must not silently succeed
without writing the complete encoding.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".