pub trait EncoderForExt {
// Provided methods
fn to_vec<F>(&self) -> Vec<u8> ⓘ
where F: 'static,
Self: EncoderFor<F> { ... }
fn encode_buffer<F>(&self, buf: &mut [u8]) -> Result<usize, usize>
where F: 'static,
Self: EncoderFor<F> { ... }
fn encode_buffer_uninit<'a, F>(
&self,
buf: &'a mut [MaybeUninit<u8>],
) -> Result<&'a mut [u8], usize>
where F: 'static,
Self: EncoderFor<F> { ... }
fn measure<F>(&self) -> usize
where F: 'static,
Self: EncoderFor<F> { ... }
}
Expand description
Helper trait for encodable objects.
Provided Methods§
Sourcefn to_vec<F>(&self) -> Vec<u8> ⓘwhere
F: 'static,
Self: EncoderFor<F>,
fn to_vec<F>(&self) -> Vec<u8> ⓘwhere
F: 'static,
Self: EncoderFor<F>,
Convert this builder into a vector of bytes. This is generally not the most efficient way to perform serialization.
Sourcefn encode_buffer<F>(&self, buf: &mut [u8]) -> Result<usize, usize>where
F: 'static,
Self: EncoderFor<F>,
fn encode_buffer<F>(&self, buf: &mut [u8]) -> Result<usize, usize>where
F: 'static,
Self: EncoderFor<F>,
Encode this builder into a given buffer. If the buffer is too small, the function will return the number of bytes required to encode the builder.
Sourcefn encode_buffer_uninit<'a, F>(
&self,
buf: &'a mut [MaybeUninit<u8>],
) -> Result<&'a mut [u8], usize>where
F: 'static,
Self: EncoderFor<F>,
fn encode_buffer_uninit<'a, F>(
&self,
buf: &'a mut [MaybeUninit<u8>],
) -> Result<&'a mut [u8], usize>where
F: 'static,
Self: EncoderFor<F>,
Encode this builder into a given buffer. If the buffer is too small, the function will return the number of bytes required to encode the builder.
fn measure<F>(&self) -> usizewhere
F: 'static,
Self: EncoderFor<F>,
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.