Skip to main content

BufferMapping

Struct BufferMapping 

Source
pub struct BufferMapping { /* private fields */ }
Expand description

Represents a mapped range in the buffer.

While returned BufferMapping is alive, Buffer::destroy and Buffer::unmap calls will block until BufferMapping is dropped.

Implementations§

Source§

impl BufferMapping

Source

pub fn ptr(&self) -> NonNull<u8>

§How to safely use the pointer
Source

pub fn mode(&self) -> MapMode

Source

pub fn len(&self) -> u64

Source

pub fn read_slice(&self) -> &[u8] ⓘ

Returns a read-only slice to the mapped buffer. BufferMapping::mode must be MapMode::Read (buffer has wgt::BufferUsages::MAP_READ set) otherwise it will panic.

Source

pub fn write_slice(&self) -> WriteOnly<'_, [u8]>

Returns a write-only slice to the mapped buffer. BufferMapping::mode must be MapMode::Write (buffer has wgt::BufferUsages::MAP_WRITE set) otherwise it will panic.

Trait Implementations§

Source§

impl Debug for BufferMapping

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for BufferMapping

§

impl !Send for BufferMapping

§

impl !Sync for BufferMapping

§

impl !UnwindSafe for BufferMapping

§

impl Forget for BufferMapping

§

impl Freeze for BufferMapping
where *const u8 is !null: Freeze, &'static RwLock<RawRwLock, BufferMapState>: Freeze, PhantomData<(&'static BufferMapState, GuardNoSend)>: Freeze, *const ArcInner<RwLock<BufferMapState>> is !null: Freeze, PhantomData<ArcInner<RwLock<BufferMapState>>>: Freeze,

§

impl Move for BufferMapping

§

impl Unpin for BufferMapping
where *const u8 is !null: Unpin, &'static RwLock<RawRwLock, BufferMapState>: Unpin, &'static BufferMapState: Unpin, GuardNoSend: Unpin, Arc<RwLock<BufferMapState>>: Unpin,

§

impl UnsafeUnpin for BufferMapping
where *const u8 is !null: UnsafeUnpin, &'static RwLock<RawRwLock, BufferMapState>: UnsafeUnpin, PhantomData<(&'static BufferMapState, GuardNoSend)>: UnsafeUnpin, *const ArcInner<RwLock<BufferMapState>> is !null: UnsafeUnpin, PhantomData<ArcInner<RwLock<BufferMapState>>>: UnsafeUnpin,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>