pub struct SnapBuf { /* private fields */ }Implementations§
Source§impl SnapBuf
impl SnapBuf
Sourcepub fn resize_zero(&mut self, new_len: usize)
pub fn resize_zero(&mut self, new_len: usize)
Resizes the buffer, so that len == new_len.
If new_len is greater than len, the new space in the buffer is filled with zeros.
Sourcepub fn write(&mut self, offset: usize, data: &[u8])
pub fn write(&mut self, offset: usize, data: &[u8])
Writes data at the specified offset.
If this extends past the current end of the buffer, the buffer is automatically resized. If offset is larger than the current buffer length, the space between the current buffer end and the written region is filled with zeros.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the length of the buffer, the number of bytes it contains.
The memory footprint of the buffer may be much smaller than this due to omission of zero segments and sharing with other buffers.
Sourcepub fn clear_range(&mut self, range: Range<usize>)
pub fn clear_range(&mut self, range: Range<usize>)
Clears data in range, possibly freeing memory.
§Panics
Panics if range end is range.end > self.len().
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SnapBuf
impl RefUnwindSafe for SnapBuf
impl Send for SnapBuf
impl Sync for SnapBuf
impl Unpin for SnapBuf
impl UnwindSafe for SnapBuf
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