pub struct ResizableBufferSink<'a, Unit> { /* private fields */ }Expand description
A byte-oriented backward-writing sink over a ResizableBuffer.
This is a safe implementation of Microsoft’s ResizableBufferSink:
units are serialized to little-endian bytes and written into the byte
buffer from the end toward the start. The write position is tracked as
a byte count from the buffer end; growth relocates existing content to
the new buffer’s end (matching Microsoft’s newBuffer.last(content.size())).
Note: this type does not implement the Sink trait (which requires
returning &[Unit], impossible safely over a byte buffer). Use it with
the low-level raw encoders via a manual write loop, or use VecSink
when trait-based sinks are required.
Implementations§
Source§impl<'a, Unit> ResizableBufferSink<'a, Unit>
impl<'a, Unit> ResizableBufferSink<'a, Unit>
Sourcepub fn new(buffer: &'a mut dyn ResizableBuffer) -> Self
pub fn new(buffer: &'a mut dyn ResizableBuffer) -> Self
Create a sink over the given buffer.
Sourcepub fn encoded_bytes(&self) -> &[u8] ⓘ
pub fn encoded_bytes(&self) -> &[u8] ⓘ
The encoded bytes (written region, in write order).
Source§impl<'a> ResizableBufferSink<'a, u8>
impl<'a> ResizableBufferSink<'a, u8>
Auto Trait Implementations§
impl<'a, Unit> !RefUnwindSafe for ResizableBufferSink<'a, Unit>
impl<'a, Unit> !Send for ResizableBufferSink<'a, Unit>
impl<'a, Unit> !Sync for ResizableBufferSink<'a, Unit>
impl<'a, Unit> !UnwindSafe for ResizableBufferSink<'a, Unit>
impl<'a, Unit> Freeze for ResizableBufferSink<'a, Unit>
impl<'a, Unit> Unpin for ResizableBufferSink<'a, Unit>where
Unit: Unpin,
impl<'a, Unit> UnsafeUnpin for ResizableBufferSink<'a, Unit>
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