Struct wgpu_core::id::Id

source ·
pub struct Id<T: 'static + WasmNotSendSync>(/* private fields */);
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) -> Self

§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) -> Self

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

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

impl<'de, T: 'static + WasmNotSendSync> Deserialize<'de> for Id<T>

source§

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

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

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

source§

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

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: &Self) -> 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: &Self) -> 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: &Self) -> 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: HalApi> Resource<Id<Adapter<Api>>> for Adapter<A>

source§

const TYPE: &'static str = "Adapter"

source§

fn as_info(&self) -> &ResourceInfo<AdapterId>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<AdapterId>

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: HalApi> Resource<Id<BindGroup<Api>>> for BindGroup<A>

source§

const TYPE: &'static str = "BindGroup"

source§

fn as_info(&self) -> &ResourceInfo<BindGroupId>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<BindGroupId>

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: HalApi> Resource<Id<BindGroupLayout<Api>>> for BindGroupLayout<A>

source§

const TYPE: &'static str = "BindGroupLayout"

source§

fn as_info(&self) -> &ResourceInfo<BindGroupLayoutId>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<BindGroupLayoutId>

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: HalApi> Resource<Id<Buffer<Api>>> for Buffer<A>

source§

const TYPE: &'static str = "Buffer"

source§

fn as_info(&self) -> &ResourceInfo<BufferId>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<BufferId>

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: HalApi> Resource<Id<CommandBuffer<Api>>> for CommandBuffer<A>

source§

const TYPE: &'static str = "CommandBuffer"

source§

fn as_info(&self) -> &ResourceInfo<CommandBufferId>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<CommandBufferId>

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: HalApi> Resource<Id<ComputePipeline<Api>>> for ComputePipeline<A>

source§

const TYPE: &'static str = "ComputePipeline"

source§

fn as_info(&self) -> &ResourceInfo<ComputePipelineId>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<ComputePipelineId>

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: HalApi> Resource<Id<Device<Api>>> for Device<A>

source§

const TYPE: &'static str = "Device"

source§

fn as_info(&self) -> &ResourceInfo<DeviceId>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<DeviceId>

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: HalApi> Resource<Id<Device<Api>>> for Queue<A>

source§

const TYPE: &'static str = "Queue"

source§

fn as_info(&self) -> &ResourceInfo<QueueId>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<QueueId>

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: HalApi> Resource<Id<PipelineLayout<Api>>> for PipelineLayout<A>

source§

const TYPE: &'static str = "PipelineLayout"

source§

fn as_info(&self) -> &ResourceInfo<PipelineLayoutId>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<PipelineLayoutId>

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: HalApi> Resource<Id<QuerySet<Api>>> for QuerySet<A>

source§

const TYPE: &'static str = "QuerySet"

source§

fn as_info(&self) -> &ResourceInfo<QuerySetId>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<QuerySetId>

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: HalApi> Resource<Id<RenderBundle<Api>>> for RenderBundle<A>

source§

const TYPE: &'static str = "RenderBundle"

source§

fn as_info(&self) -> &ResourceInfo<RenderBundleId>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<RenderBundleId>

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: HalApi> Resource<Id<RenderPipeline<Api>>> for RenderPipeline<A>

source§

const TYPE: &'static str = "RenderPipeline"

source§

fn as_info(&self) -> &ResourceInfo<RenderPipelineId>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<RenderPipelineId>

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: HalApi> Resource<Id<Sampler<Api>>> for Sampler<A>

source§

const TYPE: &'static str = "Sampler"

source§

fn as_info(&self) -> &ResourceInfo<SamplerId>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<SamplerId>

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: HalApi> Resource<Id<ShaderModule<Api>>> for ShaderModule<A>

source§

const TYPE: &'static str = "ShaderModule"

source§

fn as_info(&self) -> &ResourceInfo<ShaderModuleId>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<ShaderModuleId>

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: HalApi> Resource<Id<StagingBuffer<Api>>> for StagingBuffer<A>

source§

const TYPE: &'static str = "StagingBuffer"

source§

fn as_info(&self) -> &ResourceInfo<StagingBufferId>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<StagingBufferId>

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

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<SurfaceId>

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: HalApi> Resource<Id<Texture<Api>>> for Texture<A>

source§

const TYPE: &'static str = "Texture"

source§

fn as_info(&self) -> &ResourceInfo<TextureId>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<TextureId>

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: HalApi> Resource<Id<TextureView<Api>>> for TextureView<A>

source§

const TYPE: &'static str = "TextureView"

source§

fn as_info(&self) -> &ResourceInfo<TextureViewId>

source§

fn as_info_mut(&mut self) -> &mut ResourceInfo<TextureViewId>

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

source§

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

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

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

source§

fn zip(index: u32, epoch: u32, backend: Backend) -> Self

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> Freeze for Id<T>

§

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<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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

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

source§

impl<T> WasmNotSendSync for T

source§

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