pub struct BincodeLen<const MAX_SIZE: usize = DEFAULT_BINCODE_LEN_MAX_SIZE>;Expand description
SeqLen implementation for bincode’s default fixint encoding.
The MAX_SIZE constant is a limit on the maximum preallocation size
(in bytes) for heap allocated structures. This is a safety precaution
against malicious input causing OOM. The default is 4 MiB. Users are
free to override this limit by passing a different constant or by
implementing their own SeqLen implementation.
Trait Implementations§
Source§impl<const MAX_SIZE: usize> SeqLen for BincodeLen<MAX_SIZE>
impl<const MAX_SIZE: usize> SeqLen for BincodeLen<MAX_SIZE>
Source§fn read<'de, T>(reader: &mut impl Reader<'de>) -> ReadResult<usize>
fn read<'de, T>(reader: &mut impl Reader<'de>) -> ReadResult<usize>
Read the length of a sequence from the reader, where
T is the type of the sequence elements. This can be used to
enforce size constraints for preallocations. Read moreSource§fn write(writer: &mut impl Writer, len: usize) -> WriteResult<()>
fn write(writer: &mut impl Writer, len: usize) -> WriteResult<()>
Write the length of a sequence to the writer.
Source§fn write_bytes_needed(_len: usize) -> WriteResult<usize>
fn write_bytes_needed(_len: usize) -> WriteResult<usize>
Calculate the number of bytes needed to write the given length. Read more
Auto Trait Implementations§
impl<const MAX_SIZE: usize> Freeze for BincodeLen<MAX_SIZE>
impl<const MAX_SIZE: usize> RefUnwindSafe for BincodeLen<MAX_SIZE>
impl<const MAX_SIZE: usize> Send for BincodeLen<MAX_SIZE>
impl<const MAX_SIZE: usize> Sync for BincodeLen<MAX_SIZE>
impl<const MAX_SIZE: usize> Unpin for BincodeLen<MAX_SIZE>
impl<const MAX_SIZE: usize> UnsafeUnpin for BincodeLen<MAX_SIZE>
impl<const MAX_SIZE: usize> UnwindSafe for BincodeLen<MAX_SIZE>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more