Struct wgpu::core::id::Id

source ·
pub struct Id<T>(/* private fields */)
where
    T: 'static + WasmNotSendSync;
Expand description

An identifier for a wgpu object.

An Id<T> value identifies a value stored in a Global’s Hub’s Storage. Storage implements Index and IndexMut, accepting Id values as indices.

Note on Id typing

You might assume that an Id<T> can only be used to retrieve a resource of type T, but that is not quite the case. The id types in wgpu-core’s public API (TextureId, for example) can refer to resources belonging to any backend, but the corresponding resource types (Texture<A>, for example) are always parameterized by a specific backend A.

So the T in Id<T> is usually a resource type like Texture<Empty>, where Empty is the wgpu_hal dummy back end. These empty types are never actually used, beyond just making sure you access each Storage with the right kind of identifier. The members of Hub<A> pair up each X<Empty> type with the resource type X<A>, for some specific backend A.

Implementations§

source§

impl<T> Id<T>
where T: 'static + WasmNotSendSync,

source

pub unsafe fn from_raw(raw: NonZeroU64) -> Id<T>

Safety

The raw id must be valid for the type.

source

pub fn backend(self) -> Backend

Trait Implementations§

source§

impl<T> Clone for Id<T>
where T: 'static + WasmNotSendSync,

source§

fn clone(&self) -> Id<T>

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<T> Debug for Id<T>
where T: 'static + WasmNotSendSync,

source§

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

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

impl<T> Hash for Id<T>
where T: 'static + WasmNotSendSync,

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<T> Ord for Id<T>
where T: 'static + WasmNotSendSync,

source§

fn cmp(&self, other: &Id<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<T> PartialEq for Id<T>
where T: 'static + WasmNotSendSync,

source§

fn eq(&self, other: &Id<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> PartialOrd for Id<T>
where T: 'static + WasmNotSendSync,

source§

fn partial_cmp(&self, other: &Id<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<A> Resource<Id<Adapter<Api>>> for Adapter<A>
where A: HalApi,

source§

const TYPE: &'static str = "Adapter"

source§

fn as_info(&self) -> &ResourceInfo<Id<Adapter<Api>>>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<Adapter<Api>>>

source§

fn label(&self) -> String

source§

fn ref_count(self: &Arc<Self>) -> usize

source§

fn is_unique(self: &Arc<Self>) -> bool

source§

fn is_equal(&self, other: &Self) -> bool

source§

impl<A> Resource<Id<BindGroup<Api>>> for BindGroup<A>
where A: HalApi,

source§

const TYPE: &'static str = "BindGroup"

source§

fn as_info(&self) -> &ResourceInfo<Id<BindGroup<Api>>>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<BindGroup<Api>>>

source§

fn label(&self) -> String

source§

fn ref_count(self: &Arc<Self>) -> usize

source§

fn is_unique(self: &Arc<Self>) -> bool

source§

fn is_equal(&self, other: &Self) -> bool

source§

impl<A> Resource<Id<BindGroupLayout<Api>>> for BindGroupLayout<A>
where A: HalApi,

source§

const TYPE: &'static str = "BindGroupLayout"

source§

fn as_info(&self) -> &ResourceInfo<Id<BindGroupLayout<Api>>>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<BindGroupLayout<Api>>>

source§

fn label(&self) -> String

source§

fn ref_count(self: &Arc<Self>) -> usize

source§

fn is_unique(self: &Arc<Self>) -> bool

source§

fn is_equal(&self, other: &Self) -> bool

source§

impl<A> Resource<Id<Buffer<Api>>> for Buffer<A>
where A: HalApi,

source§

const TYPE: &'static str = "Buffer"

source§

fn as_info(&self) -> &ResourceInfo<Id<Buffer<Api>>>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<Buffer<Api>>>

source§

fn label(&self) -> String

source§

fn ref_count(self: &Arc<Self>) -> usize

source§

fn is_unique(self: &Arc<Self>) -> bool

source§

fn is_equal(&self, other: &Self) -> bool

source§

impl<A> Resource<Id<CommandBuffer<Api>>> for CommandBuffer<A>
where A: HalApi,

source§

const TYPE: &'static str = "CommandBuffer"

source§

fn as_info(&self) -> &ResourceInfo<Id<CommandBuffer<Api>>>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<CommandBuffer<Api>>>

source§

fn label(&self) -> String

source§

fn ref_count(self: &Arc<Self>) -> usize

source§

fn is_unique(self: &Arc<Self>) -> bool

source§

fn is_equal(&self, other: &Self) -> bool

source§

impl<A> Resource<Id<ComputePipeline<Api>>> for ComputePipeline<A>
where A: HalApi,

source§

const TYPE: &'static str = "ComputePipeline"

source§

fn as_info(&self) -> &ResourceInfo<Id<ComputePipeline<Api>>>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<ComputePipeline<Api>>>

source§

fn label(&self) -> String

source§

fn ref_count(self: &Arc<Self>) -> usize

source§

fn is_unique(self: &Arc<Self>) -> bool

source§

fn is_equal(&self, other: &Self) -> bool

source§

impl<A> Resource<Id<Device<Api>>> for Device<A>
where A: HalApi,

source§

const TYPE: &'static str = "Device"

source§

fn as_info(&self) -> &ResourceInfo<Id<Device<Api>>>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<Device<Api>>>

source§

fn label(&self) -> String

source§

fn ref_count(self: &Arc<Self>) -> usize

source§

fn is_unique(self: &Arc<Self>) -> bool

source§

fn is_equal(&self, other: &Self) -> bool

source§

impl<A> Resource<Id<Device<Api>>> for Queue<A>
where A: HalApi,

source§

const TYPE: &'static str = "Queue"

source§

fn as_info(&self) -> &ResourceInfo<Id<Device<Api>>>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<Device<Api>>>

source§

fn label(&self) -> String

source§

fn ref_count(self: &Arc<Self>) -> usize

source§

fn is_unique(self: &Arc<Self>) -> bool

source§

fn is_equal(&self, other: &Self) -> bool

source§

impl<A> Resource<Id<PipelineLayout<Api>>> for PipelineLayout<A>
where A: HalApi,

source§

const TYPE: &'static str = "PipelineLayout"

source§

fn as_info(&self) -> &ResourceInfo<Id<PipelineLayout<Api>>>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<PipelineLayout<Api>>>

source§

fn label(&self) -> String

source§

fn ref_count(self: &Arc<Self>) -> usize

source§

fn is_unique(self: &Arc<Self>) -> bool

source§

fn is_equal(&self, other: &Self) -> bool

source§

impl<A> Resource<Id<QuerySet<Api>>> for QuerySet<A>
where A: HalApi,

source§

const TYPE: &'static str = "QuerySet"

source§

fn as_info(&self) -> &ResourceInfo<Id<QuerySet<Api>>>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<QuerySet<Api>>>

source§

fn label(&self) -> String

source§

fn ref_count(self: &Arc<Self>) -> usize

source§

fn is_unique(self: &Arc<Self>) -> bool

source§

fn is_equal(&self, other: &Self) -> bool

source§

impl<A> Resource<Id<RenderBundle<Api>>> for RenderBundle<A>
where A: HalApi,

source§

const TYPE: &'static str = "RenderBundle"

source§

fn as_info(&self) -> &ResourceInfo<Id<RenderBundle<Api>>>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<RenderBundle<Api>>>

source§

fn label(&self) -> String

source§

fn ref_count(self: &Arc<Self>) -> usize

source§

fn is_unique(self: &Arc<Self>) -> bool

source§

fn is_equal(&self, other: &Self) -> bool

source§

impl<A> Resource<Id<RenderPipeline<Api>>> for RenderPipeline<A>
where A: HalApi,

source§

const TYPE: &'static str = "RenderPipeline"

source§

fn as_info(&self) -> &ResourceInfo<Id<RenderPipeline<Api>>>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<RenderPipeline<Api>>>

source§

fn label(&self) -> String

source§

fn ref_count(self: &Arc<Self>) -> usize

source§

fn is_unique(self: &Arc<Self>) -> bool

source§

fn is_equal(&self, other: &Self) -> bool

source§

impl<A> Resource<Id<Sampler<Api>>> for Sampler<A>
where A: HalApi,

source§

const TYPE: &'static str = "Sampler"

source§

fn as_info(&self) -> &ResourceInfo<Id<Sampler<Api>>>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<Sampler<Api>>>

source§

fn label(&self) -> String

source§

fn ref_count(self: &Arc<Self>) -> usize

source§

fn is_unique(self: &Arc<Self>) -> bool

source§

fn is_equal(&self, other: &Self) -> bool

source§

impl<A> Resource<Id<ShaderModule<Api>>> for ShaderModule<A>
where A: HalApi,

source§

const TYPE: &'static str = "ShaderModule"

source§

fn as_info(&self) -> &ResourceInfo<Id<ShaderModule<Api>>>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<ShaderModule<Api>>>

source§

fn label(&self) -> String

source§

fn ref_count(self: &Arc<Self>) -> usize

source§

fn is_unique(self: &Arc<Self>) -> bool

source§

fn is_equal(&self, other: &Self) -> bool

source§

impl<A> Resource<Id<StagingBuffer<Api>>> for StagingBuffer<A>
where A: HalApi,

source§

const TYPE: &'static str = "StagingBuffer"

source§

fn as_info(&self) -> &ResourceInfo<Id<StagingBuffer<Api>>>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<StagingBuffer<Api>>>

source§

fn label(&self) -> String

source§

fn ref_count(self: &Arc<Self>) -> usize

source§

fn is_unique(self: &Arc<Self>) -> bool

source§

fn is_equal(&self, other: &Self) -> bool

source§

impl Resource<Id<Surface>> for Surface

source§

const TYPE: &'static str = "Surface"

source§

fn as_info(&self) -> &ResourceInfo<Id<Surface>>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<Surface>>

source§

fn label(&self) -> String

source§

fn ref_count(self: &Arc<Self>) -> usize

source§

fn is_unique(self: &Arc<Self>) -> bool

source§

fn is_equal(&self, other: &Self) -> bool

source§

impl<A> Resource<Id<Texture<Api>>> for Texture<A>
where A: HalApi,

source§

const TYPE: &'static str = "Texture"

source§

fn as_info(&self) -> &ResourceInfo<Id<Texture<Api>>>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<Texture<Api>>>

source§

fn label(&self) -> String

source§

fn ref_count(self: &Arc<Self>) -> usize

source§

fn is_unique(self: &Arc<Self>) -> bool

source§

fn is_equal(&self, other: &Self) -> bool

source§

impl<A> Resource<Id<TextureView<Api>>> for TextureView<A>
where A: HalApi,

source§

const TYPE: &'static str = "TextureView"

source§

fn as_info(&self) -> &ResourceInfo<Id<TextureView<Api>>>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<TextureView<Api>>>

source§

fn label(&self) -> String

source§

fn ref_count(self: &Arc<Self>) -> usize

source§

fn is_unique(self: &Arc<Self>) -> bool

source§

fn is_equal(&self, other: &Self) -> bool

source§

impl<T> TypedId for Id<T>
where T: 'static + WasmNotSendSync,

source§

fn zip(index: u32, epoch: u32, backend: Backend) -> Id<T>

source§

fn unzip(self) -> (u32, u32, Backend)

source§

fn into_raw(self) -> NonZeroU64

source§

impl<T> Copy for Id<T>
where T: 'static + WasmNotSendSync,

source§

impl<T> Eq for Id<T>
where T: 'static + WasmNotSendSync,

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for Id<T>
where T: RefUnwindSafe,

§

impl<T> Send for Id<T>

§

impl<T> Sync for Id<T>

§

impl<T> Unpin for Id<T>
where T: Unpin,

§

impl<T> UnwindSafe for Id<T>
where T: 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<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
source§

impl<T> Downcast<T> for T

source§

fn downcast(&self) -> &T

source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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,

§

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>,

§

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>,

§

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>

source§

impl<T> WasmNotSend for T
where T: Send,

source§

impl<T> WasmNotSendSync for T

source§

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