wgpu

Type Alias BufferDescriptor

Source
pub type BufferDescriptor<'a> = BufferDescriptor<Label<'a>>;
Expand description

Describes a Buffer.

For use with Device::create_buffer.

Corresponds to WebGPU GPUBufferDescriptor.

Aliased Type§

struct BufferDescriptor<'a> {
    pub label: Option<&'a str>,
    pub size: u64,
    pub usage: BufferUsages,
    pub mapped_at_creation: bool,
}

Fields§

§label: Option<&'a str>

Debug label of a buffer. This will show up in graphics debuggers for easy identification.

§size: u64

Size of a buffer, in bytes.

§usage: BufferUsages

Usages of a buffer. If the buffer is used in any way that isn’t specified here, the operation will panic.

§mapped_at_creation: bool

Allows a buffer to be mapped immediately after they are made. It does not have to be [BufferUsages::MAP_READ] or [BufferUsages::MAP_WRITE], all buffers are allowed to be mapped at creation.

If this is true, size must be a multiple of [COPY_BUFFER_ALIGNMENT].

Implementations

Source§

impl<L> BufferDescriptor<L>

Source

pub fn map_label<K>(&self, fun: impl FnOnce(&L) -> K) -> BufferDescriptor<K>

Takes a closure and maps the label of the buffer descriptor into another.

Trait Implementations

Source§

impl<L> Clone for BufferDescriptor<L>
where L: Clone,

Source§

fn clone(&self) -> BufferDescriptor<L>

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<L> Debug for BufferDescriptor<L>
where L: Debug,

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de, L> Deserialize<'de> for BufferDescriptor<L>
where L: Deserialize<'de>,

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<BufferDescriptor<L>, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<L> Hash for BufferDescriptor<L>
where L: Hash,

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<L> PartialEq for BufferDescriptor<L>
where L: PartialEq,

Source§

fn eq(&self, other: &BufferDescriptor<L>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<L> Serialize for BufferDescriptor<L>
where L: Serialize,

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<L> Eq for BufferDescriptor<L>
where L: Eq,

Source§

impl<L> StructuralPartialEq for BufferDescriptor<L>