pub(crate) struct LengthPrefixedBuffer<'a> {
pub(crate) buf: &'a mut Vec<u8>,
len_offset: usize,
size_len: ListLength,
}
Expand description
Tracks encoding a length-delimited structure in a single pass.
Fields§
§buf: &'a mut Vec<u8>
§len_offset: usize
§size_len: ListLength
Implementations§
Source§impl<'a> LengthPrefixedBuffer<'a>
impl<'a> LengthPrefixedBuffer<'a>
Sourcepub(crate) fn new(size_len: ListLength, buf: &'a mut Vec<u8>) -> Self
pub(crate) fn new(size_len: ListLength, buf: &'a mut Vec<u8>) -> Self
Inserts a dummy length into buf
, and remembers where it went.
After this, the body of the length-delimited structure should be appended to LengthPrefixedBuffer::buf
.
The length header is corrected in LengthPrefixedBuffer::drop
.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for LengthPrefixedBuffer<'a>
impl<'a> RefUnwindSafe for LengthPrefixedBuffer<'a>
impl<'a> Send for LengthPrefixedBuffer<'a>
impl<'a> Sync for LengthPrefixedBuffer<'a>
impl<'a> Unpin for LengthPrefixedBuffer<'a>
impl<'a> !UnwindSafe for LengthPrefixedBuffer<'a>
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