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
pub fn as_ref(&self) -> BufferRef<'_>
pub fn into_ref(self) -> BufferRef<'a>
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.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for MutableBufferRef<'a>
impl<'a> RefUnwindSafe for MutableBufferRef<'a>
impl<'a> Send for MutableBufferRef<'a>
impl<'a> Sync for MutableBufferRef<'a>
impl<'a> Unpin for MutableBufferRef<'a>
impl<'a> !UnwindSafe for MutableBufferRef<'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