pub struct MutableBufferRef<'a> { /* private fields */ }Expand description
MutableBufferRef is an unowned, read-write view of a Buffer.
Implementations§
Source§impl<'a> MutableBufferRef<'a>
impl<'a> MutableBufferRef<'a>
pub fn is_empty(&self) -> bool
Sourcepub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
pub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
Returns a mutable slice of the buffer’s contents.
Sourcepub fn reborrow(&mut self) -> MutableBufferRef<'_>
pub fn reborrow(&mut self) -> MutableBufferRef<'_>
Reborrows this reference with a lesser lifetime. This mirrors the usual borrowing semantics (i.e. the borrow ends when the new reference goes out of scope), and exists so that a MutableBufferRef can be subsliced without consuming it.
For example: let mut buf: MutableBufferRef<’_> = …; { let sub = buf.reborrow().subslice_mut(a..b); }
Sourcepub fn subslice<R: SliceRange>(&self, range: R) -> BufferRef<'_>
pub fn subslice<R: SliceRange>(&self, range: R) -> BufferRef<'_>
Slices this reference. See Buffer::subslice.
Sourcepub fn subslice_mut<R: SliceRange>(self, range: R) -> MutableBufferRef<'a>
pub fn subslice_mut<R: SliceRange>(self, range: R) -> MutableBufferRef<'a>
Slices and consumes this reference. See Buffer::subslice_mut.
Sourcepub fn split_at(&self, mid: usize) -> (BufferRef<'_>, BufferRef<'_>)
pub fn split_at(&self, mid: usize) -> (BufferRef<'_>, BufferRef<'_>)
Splits at mid (included in the right child), yielding two BufferRefs.
Sourcepub fn split_at_mut(
self,
mid: usize,
) -> (MutableBufferRef<'a>, MutableBufferRef<'a>)
pub fn split_at_mut( self, mid: usize, ) -> (MutableBufferRef<'a>, MutableBufferRef<'a>)
Consumes the reference and splits it at mid (included in the right child), yielding two
MutableBufferRefs.
Sourcepub fn range(&self) -> Range<usize>
pub fn range(&self) -> Range<usize>
Returns the range in the underlying BufferSource that this MutableBufferRef covers.
Sourcepub fn copy_to_slice(&self, dest: &mut [u8])
pub fn copy_to_slice(&self, dest: &mut [u8])
Sourcepub fn copy_from_slice(&mut self, src: &[u8])
pub fn copy_from_slice(&mut self, src: &[u8])
Sourcepub fn copy_from_buffer(&mut self, src: BufferRef<'_>)
pub fn copy_from_buffer(&mut self, src: BufferRef<'_>)
Sourcepub fn as_mut_ptr(&mut self) -> *mut u8
pub fn as_mut_ptr(&mut self) -> *mut u8
Returns a mutable raw pointer to the buffer’s contents.
Sourcepub fn as_ptr_slice(&self) -> PtrByteSlice<'_>
pub fn as_ptr_slice(&self) -> PtrByteSlice<'_>
Returns a read-only pointer slice over the buffer.
Sourcepub fn as_mut_ptr_slice(&mut self) -> MutPtrByteSlice<'_>
pub fn as_mut_ptr_slice(&mut self) -> MutPtrByteSlice<'_>
Returns a mutable pointer slice over the buffer.
Sourcepub fn into_mut_ptr_slice(self) -> MutPtrByteSlice<'a>
pub fn into_mut_ptr_slice(self) -> MutPtrByteSlice<'a>
Consumes this reference and returns a mutable pointer slice.