Skip to main content

BufferData

Struct BufferData 

Source
pub struct BufferData<'data, U = DynamicBufferUsages> { /* private fields */ }

Implementations§

Source§

impl<'data> BufferData<'data, BufferNoUsages>

Source

pub fn empty(size: u32) -> Self

Source

pub fn new(data: &'data [u8]) -> Self

Source§

impl<'data, U> BufferData<'data, U>

Source

pub fn read(self) -> BufferData<'data, U::Out>
where U: Use<dyn Read>,

Enables the read usage.

This allows the buffer to be used for reading. Compile-time enforcement ensures the correct usage is present.

Source

pub fn write(self) -> BufferData<'data, U::Out>
where U: Use<dyn Write>,

Enables the write usage.

This allows the buffer to be used for writing. Compile-time enforcement ensures the correct usage is present.

Source

pub fn copy_from(self) -> BufferData<'data, U::Out>
where U: Use<dyn CopyFrom>,

Enables the copy from usage.

This allows the buffer to be used for coping from it. Compile-time enforcement ensures the correct usage is present.

Source

pub fn copy_to(self) -> BufferData<'data, U::Out>
where U: Use<dyn CopyTo>,

Enables the copy to usage.

This allows the buffer to be used for coping to it. Compile-time enforcement ensures the correct usage is present.

Source

pub fn erase(self) -> BufferData<'data>
where U: BufferUsages,

Erases the static type information about usages.

The full static type of a buffer includes information about all of its usages, for example: Buffer<MapRead<true>>. This enables compile-time checks for required usages - for example, you won’t be able to read from a buffer without the read usage. However, this strict typing significantly complicates type management.

As a compromise, you can call this method to erase usage information from the type, which moves the checks to runtime instead. In this case, using the buffer in a context where the required usage is missing will cause a panic.

Trait Implementations§

Source§

impl<'data, U: Clone> Clone for BufferData<'data, U>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'data, U: Copy> Copy for BufferData<'data, U>

Source§

impl<'data, U: Debug> Debug for BufferData<'data, U>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'data, U> Freeze for BufferData<'data, U>
where U: Freeze,

§

impl<'data, U> RefUnwindSafe for BufferData<'data, U>
where U: RefUnwindSafe,

§

impl<'data, U> Send for BufferData<'data, U>
where U: Send,

§

impl<'data, U> Sync for BufferData<'data, U>
where U: Sync,

§

impl<'data, U> Unpin for BufferData<'data, U>
where U: Unpin,

§

impl<'data, U> UnsafeUnpin for BufferData<'data, U>
where U: UnsafeUnpin,

§

impl<'data, U> UnwindSafe for BufferData<'data, U>
where U: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,