pub struct Writer<'w, B: ?Sized> { /* private fields */ }Expand description
A structure wrapping a mutable pointer to a buffer
Implementations§
Source§impl<'w> Writer<'w, [u8]>
impl<'w> Writer<'w, [u8]>
Sourcepub fn from_slice(slice: &'w mut [u8]) -> Self
pub fn from_slice(slice: &'w mut [u8]) -> Self
Create a new writer from a mutable byte slice
Sourcepub fn from_slice_position(slice: &'w mut [u8], pos: usize) -> Self
pub fn from_slice_position(slice: &'w mut [u8], pos: usize) -> Self
Create a new writer from a mutable byte slice, skipping a prefix
Source§impl<'w> Writer<'w, Vec<u8>>
impl<'w> Writer<'w, Vec<u8>>
Sourcepub fn from_vec(vec: &'w mut Vec<u8>) -> Self
Available on crate feature alloc only.
pub fn from_vec(vec: &'w mut Vec<u8>) -> Self
alloc only.Create a new writer from a mutable Vec
Sourcepub fn from_vec_skip(vec: &'w mut Vec<u8>, pos: usize) -> Self
Available on crate feature alloc only.
pub fn from_vec_skip(vec: &'w mut Vec<u8>, pos: usize) -> Self
alloc only.Create a new writer from a mutable Vec
Trait Implementations§
Source§impl ResizeBuffer for Writer<'_, [u8]>
impl ResizeBuffer for Writer<'_, [u8]>
Source§fn buffer_insert(&mut self, pos: usize, data: &[u8]) -> Result<(), Error>
fn buffer_insert(&mut self, pos: usize, data: &[u8]) -> Result<(), Error>
Insert a slice at the given position in the buffer
Source§fn buffer_remove(&mut self, range: Range<usize>) -> Result<(), Error>
fn buffer_remove(&mut self, range: Range<usize>) -> Result<(), Error>
Remove an exclusive range from the buffer
Source§impl<B: ResizeBuffer + ?Sized> ResizeBuffer for Writer<'_, B>
impl<B: ResizeBuffer + ?Sized> ResizeBuffer for Writer<'_, B>
Source§fn buffer_insert(&mut self, pos: usize, data: &[u8]) -> Result<(), Error>
fn buffer_insert(&mut self, pos: usize, data: &[u8]) -> Result<(), Error>
Insert a slice at the given position in the buffer
Source§fn buffer_remove(&mut self, range: Range<usize>) -> Result<(), Error>
fn buffer_remove(&mut self, range: Range<usize>) -> Result<(), Error>
Remove an exclusive range from the buffer
Source§impl<'b, B: ?Sized> Write for Writer<'b, B>where
Writer<'b, B>: WriteBuffer,
impl<'b, B: ?Sized> Write for Writer<'b, B>where
Writer<'b, B>: WriteBuffer,
Source§impl WriteBuffer for Writer<'_, [u8]>
impl WriteBuffer for Writer<'_, [u8]>
Source§impl<B: WriteBuffer + ?Sized> WriteBuffer for Writer<'_, B>
impl<B: WriteBuffer + ?Sized> WriteBuffer for Writer<'_, B>
Auto Trait Implementations§
impl<'w, B> Freeze for Writer<'w, B>where
B: ?Sized,
impl<'w, B> RefUnwindSafe for Writer<'w, B>where
B: RefUnwindSafe + ?Sized,
impl<'w, B> Send for Writer<'w, B>
impl<'w, B> Sync for Writer<'w, B>
impl<'w, B> Unpin for Writer<'w, B>where
B: ?Sized,
impl<'w, B> !UnwindSafe for Writer<'w, B>
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