storage_device::buffer

Struct MutableBufferRef

Source
pub struct MutableBufferRef<'a> { /* private fields */ }
Expand description

MutableBufferRef is an unowned, read-write view of a Buffer.

Implementations§

Source§

impl<'a> MutableBufferRef<'a>

Source

pub fn len(&self) -> usize

Returns the buffer’s capacity.

Source

pub fn is_empty(&self) -> bool

Source

pub fn as_ref(&self) -> BufferRef<'_>

Source

pub fn into_ref(self) -> BufferRef<'a>

Source

pub fn as_slice(&self) -> &[u8]

Returns a slice of the buffer’s contents.

Source

pub fn as_mut_slice(&mut self) -> &mut [u8]

Returns a mutable slice of the buffer’s contents.

Source

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); }

Source

pub fn subslice<R: SliceRange>(&self, range: R) -> BufferRef<'_>

Slices this reference. See Buffer::subslice.

Source

pub fn subslice_mut<R: SliceRange>(self, range: R) -> MutableBufferRef<'a>

Slices and consumes this reference. See Buffer::subslice_mut.

Source

pub fn split_at(&self, mid: usize) -> (BufferRef<'_>, BufferRef<'_>)

Splits at |mid| (included in the right child), yielding two BufferRefs.

Source

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.

Source

pub fn range(&self) -> Range<usize>

Returns the range in the underlying BufferSource that this MutableBufferRef covers. TODO(jfsulliv): Currently unused in host code. Remove when there is a real Device impl.

Trait Implementations§

Source§

impl<'a> Debug for MutableBufferRef<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V