pub trait PreparedLayout {
type ViewMut<'output>;
// Required methods
fn encoded_len(&self) -> usize;
fn commit_into<'output>(
self,
output: &'output mut [u8],
) -> Result<(Self::ViewMut<'output>, &'output mut [u8]), OutputTooShortError>;
}Expand description
A prepared layout encoding that can be committed into an output buffer.
Preparation performs every fallible codec operation. Implementations only check output capacity and copy already-prepared encodings when committed.
Required Associated Types§
Required Methods§
Sourcefn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Returns the exact number of output bytes required for this layout.
Sourcefn commit_into<'output>(
self,
output: &'output mut [u8],
) -> Result<(Self::ViewMut<'output>, &'output mut [u8]), OutputTooShortError>
fn commit_into<'output>( self, output: &'output mut [u8], ) -> Result<(Self::ViewMut<'output>, &'output mut [u8]), OutputTooShortError>
Commits this prepared layout into the leading output bytes.
Extra output bytes are returned as a disjoint suffix. A short output is left unchanged.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".