pub struct EncoderImpl<W: Writer, C: Config> { /* private fields */ }Expand description
An Encoder that writes bytes into a given writer W.
This struct should rarely be used.
In most cases, prefer any of the encode functions.
The ByteOrder that is chosen will impact the endianness that
is used to write integers to the writer.
let slice: &mut [u8] = &mut [0, 0, 0, 0];
let config = bincode_next::config::legacy().with_big_endian();
let mut encoder = EncoderImpl::new(SliceWriter::new(slice), config);
// this u32 can be any Encodable
5u32.encode(&mut encoder).unwrap();
assert_eq!(encoder.into_writer().bytes_written(), 4);
assert_eq!(slice, [0, 0, 0, 5]);Implementations§
Source§impl<W: Writer, C: Config> EncoderImpl<W, C>
impl<W: Writer, C: Config> EncoderImpl<W, C>
Sourcepub fn into_writer(self) -> W
pub fn into_writer(self) -> W
Return the underlying writer