pub trait DecodeTarget {
// Required method
fn decode_with(
&mut self,
max_len: usize,
f: impl for<'a> FnOnce(&'a mut [u8]) -> Result<usize>,
) -> Result<usize>;
}
Expand description
Represents a buffer that can be decoded into. See DecodeBuilder::onto
and the provided
implementations for more details.
Required Methods§
Sourcefn decode_with(
&mut self,
max_len: usize,
f: impl for<'a> FnOnce(&'a mut [u8]) -> Result<usize>,
) -> Result<usize>
fn decode_with( &mut self, max_len: usize, f: impl for<'a> FnOnce(&'a mut [u8]) -> Result<usize>, ) -> Result<usize>
Decodes into this buffer, provides the maximum length for implementations that wish to preallocate space, along with a function that will write bytes into the buffer and return the length written to it.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.