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§
Trait Implementations§
source§impl<T> Clone for Id<T>where
T: 'static + WasmNotSendSync,
impl<T> Clone for Id<T>where
T: 'static + WasmNotSendSync,
source§impl<T> Debug for Id<T>where
T: 'static + WasmNotSendSync,
impl<T> Debug for Id<T>where
T: 'static + WasmNotSendSync,
source§impl<T> Hash for Id<T>where
T: 'static + WasmNotSendSync,
impl<T> Hash for Id<T>where
T: 'static + WasmNotSendSync,
source§impl<T> Ord for Id<T>where
T: 'static + WasmNotSendSync,
impl<T> Ord for Id<T>where
T: 'static + WasmNotSendSync,
source§impl<T> PartialEq for Id<T>where
T: 'static + WasmNotSendSync,
impl<T> PartialEq for Id<T>where
T: 'static + WasmNotSendSync,
source§impl<T> PartialOrd for Id<T>where
T: 'static + WasmNotSendSync,
impl<T> PartialOrd for Id<T>where
T: 'static + WasmNotSendSync,
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<A: HalApi> Resource<Id<Adapter<Api>>> for Adapter<A>
impl<A: HalApi> Resource<Id<Adapter<Api>>> for Adapter<A>
const TYPE: &'static str = "Adapter"
fn as_info(&self) -> &ResourceInfo<AdapterId>
fn as_info_mut(&mut self) -> &mut ResourceInfo<AdapterId>
fn label(&self) -> String
fn ref_count(self: &Arc<Self>) -> usize
fn is_unique(self: &Arc<Self>) -> bool
fn is_equal(&self, other: &Self) -> bool
source§impl<A: HalApi> Resource<Id<BindGroup<Api>>> for BindGroup<A>
impl<A: HalApi> Resource<Id<BindGroup<Api>>> for BindGroup<A>
const TYPE: &'static str = "BindGroup"
fn as_info(&self) -> &ResourceInfo<BindGroupId>
fn as_info_mut(&mut self) -> &mut ResourceInfo<BindGroupId>
fn label(&self) -> String
fn ref_count(self: &Arc<Self>) -> usize
fn is_unique(self: &Arc<Self>) -> bool
fn is_equal(&self, other: &Self) -> bool
source§impl<A: HalApi> Resource<Id<BindGroupLayout<Api>>> for BindGroupLayout<A>
impl<A: HalApi> Resource<Id<BindGroupLayout<Api>>> for BindGroupLayout<A>
const TYPE: &'static str = "BindGroupLayout"
fn as_info(&self) -> &ResourceInfo<BindGroupLayoutId>
fn as_info_mut(&mut self) -> &mut ResourceInfo<BindGroupLayoutId>
fn label(&self) -> String
fn ref_count(self: &Arc<Self>) -> usize
fn is_unique(self: &Arc<Self>) -> bool
fn is_equal(&self, other: &Self) -> bool
source§impl<A: HalApi> Resource<Id<Buffer<Api>>> for Buffer<A>
impl<A: HalApi> Resource<Id<Buffer<Api>>> for Buffer<A>
const TYPE: &'static str = "Buffer"
fn as_info(&self) -> &ResourceInfo<BufferId>
fn as_info_mut(&mut self) -> &mut ResourceInfo<BufferId>
fn label(&self) -> String
fn ref_count(self: &Arc<Self>) -> usize
fn is_unique(self: &Arc<Self>) -> bool
fn is_equal(&self, other: &Self) -> bool
source§impl<A: HalApi> Resource<Id<CommandBuffer<Api>>> for CommandBuffer<A>
impl<A: HalApi> Resource<Id<CommandBuffer<Api>>> for CommandBuffer<A>
const TYPE: &'static str = "CommandBuffer"
fn as_info(&self) -> &ResourceInfo<CommandBufferId>
fn as_info_mut(&mut self) -> &mut ResourceInfo<CommandBufferId>
fn label(&self) -> String
fn ref_count(self: &Arc<Self>) -> usize
fn is_unique(self: &Arc<Self>) -> bool
fn is_equal(&self, other: &Self) -> bool
source§impl<A: HalApi> Resource<Id<ComputePipeline<Api>>> for ComputePipeline<A>
impl<A: HalApi> Resource<Id<ComputePipeline<Api>>> for ComputePipeline<A>
const TYPE: &'static str = "ComputePipeline"
fn as_info(&self) -> &ResourceInfo<ComputePipelineId>
fn as_info_mut(&mut self) -> &mut ResourceInfo<ComputePipelineId>
fn label(&self) -> String
fn ref_count(self: &Arc<Self>) -> usize
fn is_unique(self: &Arc<Self>) -> bool
fn is_equal(&self, other: &Self) -> bool
source§impl<A: HalApi> Resource<Id<Device<Api>>> for Device<A>
impl<A: HalApi> Resource<Id<Device<Api>>> for Device<A>
const TYPE: &'static str = "Device"
fn as_info(&self) -> &ResourceInfo<DeviceId>
fn as_info_mut(&mut self) -> &mut ResourceInfo<DeviceId>
fn label(&self) -> String
fn ref_count(self: &Arc<Self>) -> usize
fn is_unique(self: &Arc<Self>) -> bool
fn is_equal(&self, other: &Self) -> bool
source§impl<A: HalApi> Resource<Id<Device<Api>>> for Queue<A>
impl<A: HalApi> Resource<Id<Device<Api>>> for Queue<A>
const TYPE: &'static str = "Queue"
fn as_info(&self) -> &ResourceInfo<QueueId>
fn as_info_mut(&mut self) -> &mut ResourceInfo<QueueId>
fn label(&self) -> String
fn ref_count(self: &Arc<Self>) -> usize
fn is_unique(self: &Arc<Self>) -> bool
fn is_equal(&self, other: &Self) -> bool
source§impl<A: HalApi> Resource<Id<PipelineLayout<Api>>> for PipelineLayout<A>
impl<A: HalApi> Resource<Id<PipelineLayout<Api>>> for PipelineLayout<A>
const TYPE: &'static str = "PipelineLayout"
fn as_info(&self) -> &ResourceInfo<PipelineLayoutId>
fn as_info_mut(&mut self) -> &mut ResourceInfo<PipelineLayoutId>
fn label(&self) -> String
fn ref_count(self: &Arc<Self>) -> usize
fn is_unique(self: &Arc<Self>) -> bool
fn is_equal(&self, other: &Self) -> bool
source§impl<A: HalApi> Resource<Id<QuerySet<Api>>> for QuerySet<A>
impl<A: HalApi> Resource<Id<QuerySet<Api>>> for QuerySet<A>
const TYPE: &'static str = "QuerySet"
fn as_info(&self) -> &ResourceInfo<QuerySetId>
fn as_info_mut(&mut self) -> &mut ResourceInfo<QuerySetId>
fn label(&self) -> String
fn ref_count(self: &Arc<Self>) -> usize
fn is_unique(self: &Arc<Self>) -> bool
fn is_equal(&self, other: &Self) -> bool
source§impl<A: HalApi> Resource<Id<RenderBundle<Api>>> for RenderBundle<A>
impl<A: HalApi> Resource<Id<RenderBundle<Api>>> for RenderBundle<A>
const TYPE: &'static str = "RenderBundle"
fn as_info(&self) -> &ResourceInfo<RenderBundleId>
fn as_info_mut(&mut self) -> &mut ResourceInfo<RenderBundleId>
fn label(&self) -> String
fn ref_count(self: &Arc<Self>) -> usize
fn is_unique(self: &Arc<Self>) -> bool
fn is_equal(&self, other: &Self) -> bool
source§impl<A: HalApi> Resource<Id<RenderPipeline<Api>>> for RenderPipeline<A>
impl<A: HalApi> Resource<Id<RenderPipeline<Api>>> for RenderPipeline<A>
const TYPE: &'static str = "RenderPipeline"
fn as_info(&self) -> &ResourceInfo<RenderPipelineId>
fn as_info_mut(&mut self) -> &mut ResourceInfo<RenderPipelineId>
fn label(&self) -> String
fn ref_count(self: &Arc<Self>) -> usize
fn is_unique(self: &Arc<Self>) -> bool
fn is_equal(&self, other: &Self) -> bool
source§impl<A: HalApi> Resource<Id<Sampler<Api>>> for Sampler<A>
impl<A: HalApi> Resource<Id<Sampler<Api>>> for Sampler<A>
const TYPE: &'static str = "Sampler"
fn as_info(&self) -> &ResourceInfo<SamplerId>
fn as_info_mut(&mut self) -> &mut ResourceInfo<SamplerId>
fn label(&self) -> String
fn ref_count(self: &Arc<Self>) -> usize
fn is_unique(self: &Arc<Self>) -> bool
fn is_equal(&self, other: &Self) -> bool
source§impl<A: HalApi> Resource<Id<ShaderModule<Api>>> for ShaderModule<A>
impl<A: HalApi> Resource<Id<ShaderModule<Api>>> for ShaderModule<A>
const TYPE: &'static str = "ShaderModule"
fn as_info(&self) -> &ResourceInfo<ShaderModuleId>
fn as_info_mut(&mut self) -> &mut ResourceInfo<ShaderModuleId>
fn label(&self) -> String
fn ref_count(self: &Arc<Self>) -> usize
fn is_unique(self: &Arc<Self>) -> bool
fn is_equal(&self, other: &Self) -> bool
source§impl<A: HalApi> Resource<Id<StagingBuffer<Api>>> for StagingBuffer<A>
impl<A: HalApi> Resource<Id<StagingBuffer<Api>>> for StagingBuffer<A>
const TYPE: &'static str = "StagingBuffer"
fn as_info(&self) -> &ResourceInfo<StagingBufferId>
fn as_info_mut(&mut self) -> &mut ResourceInfo<StagingBufferId>
fn label(&self) -> String
fn ref_count(self: &Arc<Self>) -> usize
fn is_unique(self: &Arc<Self>) -> bool
fn is_equal(&self, other: &Self) -> bool
source§impl Resource<Id<Surface>> for Surface
impl Resource<Id<Surface>> for Surface
const TYPE: &'static str = "Surface"
fn as_info(&self) -> &ResourceInfo<SurfaceId>
fn as_info_mut(&mut self) -> &mut ResourceInfo<SurfaceId>
fn label(&self) -> String
fn ref_count(self: &Arc<Self>) -> usize
fn is_unique(self: &Arc<Self>) -> bool
fn is_equal(&self, other: &Self) -> bool
source§impl<A: HalApi> Resource<Id<Texture<Api>>> for Texture<A>
impl<A: HalApi> Resource<Id<Texture<Api>>> for Texture<A>
const TYPE: &'static str = "Texture"
fn as_info(&self) -> &ResourceInfo<TextureId>
fn as_info_mut(&mut self) -> &mut ResourceInfo<TextureId>
fn label(&self) -> String
fn ref_count(self: &Arc<Self>) -> usize
fn is_unique(self: &Arc<Self>) -> bool
fn is_equal(&self, other: &Self) -> bool
source§impl<A: HalApi> Resource<Id<TextureView<Api>>> for TextureView<A>
impl<A: HalApi> Resource<Id<TextureView<Api>>> for TextureView<A>
const TYPE: &'static str = "TextureView"
fn as_info(&self) -> &ResourceInfo<TextureViewId>
fn as_info_mut(&mut self) -> &mut ResourceInfo<TextureViewId>
fn label(&self) -> String
fn ref_count(self: &Arc<Self>) -> usize
fn is_unique(self: &Arc<Self>) -> bool
fn is_equal(&self, other: &Self) -> bool
source§impl<T> TypedId for Id<T>where
T: 'static + WasmNotSendSync,
impl<T> TypedId for Id<T>where
T: 'static + WasmNotSendSync,
impl<T> Copy for Id<T>where
T: 'static + WasmNotSendSync,
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.