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§
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> From<ObjectId> for Id<T>where
T: 'static + WasmNotSendSync,
impl<T> From<ObjectId> 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,
Source§impl<A> Resource<Id<Adapter<Api>>> for Adapter<A>where
A: HalApi,
impl<A> Resource<Id<Adapter<Api>>> for Adapter<A>where
A: HalApi,
const TYPE: &'static str = "Adapter"
fn as_info(&self) -> &ResourceInfo<Id<Adapter<Api>>>
fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<Adapter<Api>>>
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> Resource<Id<BindGroup<Api>>> for BindGroup<A>where
A: HalApi,
impl<A> Resource<Id<BindGroup<Api>>> for BindGroup<A>where
A: HalApi,
const TYPE: &'static str = "BindGroup"
fn as_info(&self) -> &ResourceInfo<Id<BindGroup<Api>>>
fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<BindGroup<Api>>>
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> Resource<Id<BindGroupLayout<Api>>> for BindGroupLayout<A>where
A: HalApi,
impl<A> Resource<Id<BindGroupLayout<Api>>> for BindGroupLayout<A>where
A: HalApi,
const TYPE: &'static str = "BindGroupLayout"
fn as_info(&self) -> &ResourceInfo<Id<BindGroupLayout<Api>>>
fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<BindGroupLayout<Api>>>
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> Resource<Id<Buffer<Api>>> for Buffer<A>where
A: HalApi,
impl<A> Resource<Id<Buffer<Api>>> for Buffer<A>where
A: HalApi,
const TYPE: &'static str = "Buffer"
fn as_info(&self) -> &ResourceInfo<Id<Buffer<Api>>>
fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<Buffer<Api>>>
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> Resource<Id<CommandBuffer<Api>>> for CommandBuffer<A>where
A: HalApi,
impl<A> Resource<Id<CommandBuffer<Api>>> for CommandBuffer<A>where
A: HalApi,
const TYPE: &'static str = "CommandBuffer"
fn as_info(&self) -> &ResourceInfo<Id<CommandBuffer<Api>>>
fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<CommandBuffer<Api>>>
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> Resource<Id<ComputePipeline<Api>>> for ComputePipeline<A>where
A: HalApi,
impl<A> Resource<Id<ComputePipeline<Api>>> for ComputePipeline<A>where
A: HalApi,
const TYPE: &'static str = "ComputePipeline"
fn as_info(&self) -> &ResourceInfo<Id<ComputePipeline<Api>>>
fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<ComputePipeline<Api>>>
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> Resource<Id<Device<Api>>> for Device<A>where
A: HalApi,
impl<A> Resource<Id<Device<Api>>> for Device<A>where
A: HalApi,
const TYPE: &'static str = "Device"
fn as_info(&self) -> &ResourceInfo<Id<Device<Api>>>
fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<Device<Api>>>
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> Resource<Id<Device<Api>>> for Queue<A>where
A: HalApi,
impl<A> Resource<Id<Device<Api>>> for Queue<A>where
A: HalApi,
const TYPE: &'static str = "Queue"
fn as_info(&self) -> &ResourceInfo<Id<Device<Api>>>
fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<Device<Api>>>
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> Resource<Id<PipelineLayout<Api>>> for PipelineLayout<A>where
A: HalApi,
impl<A> Resource<Id<PipelineLayout<Api>>> for PipelineLayout<A>where
A: HalApi,
const TYPE: &'static str = "PipelineLayout"
fn as_info(&self) -> &ResourceInfo<Id<PipelineLayout<Api>>>
fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<PipelineLayout<Api>>>
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> Resource<Id<QuerySet<Api>>> for QuerySet<A>where
A: HalApi,
impl<A> Resource<Id<QuerySet<Api>>> for QuerySet<A>where
A: HalApi,
const TYPE: &'static str = "QuerySet"
fn as_info(&self) -> &ResourceInfo<Id<QuerySet<Api>>>
fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<QuerySet<Api>>>
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> Resource<Id<RenderBundle<Api>>> for RenderBundle<A>where
A: HalApi,
impl<A> Resource<Id<RenderBundle<Api>>> for RenderBundle<A>where
A: HalApi,
const TYPE: &'static str = "RenderBundle"
fn as_info(&self) -> &ResourceInfo<Id<RenderBundle<Api>>>
fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<RenderBundle<Api>>>
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> Resource<Id<RenderPipeline<Api>>> for RenderPipeline<A>where
A: HalApi,
impl<A> Resource<Id<RenderPipeline<Api>>> for RenderPipeline<A>where
A: HalApi,
const TYPE: &'static str = "RenderPipeline"
fn as_info(&self) -> &ResourceInfo<Id<RenderPipeline<Api>>>
fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<RenderPipeline<Api>>>
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> Resource<Id<Sampler<Api>>> for Sampler<A>where
A: HalApi,
impl<A> Resource<Id<Sampler<Api>>> for Sampler<A>where
A: HalApi,
const TYPE: &'static str = "Sampler"
fn as_info(&self) -> &ResourceInfo<Id<Sampler<Api>>>
fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<Sampler<Api>>>
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> Resource<Id<ShaderModule<Api>>> for ShaderModule<A>where
A: HalApi,
impl<A> Resource<Id<ShaderModule<Api>>> for ShaderModule<A>where
A: HalApi,
const TYPE: &'static str = "ShaderModule"
fn as_info(&self) -> &ResourceInfo<Id<ShaderModule<Api>>>
fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<ShaderModule<Api>>>
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> Resource<Id<StagingBuffer<Api>>> for StagingBuffer<A>where
A: HalApi,
impl<A> Resource<Id<StagingBuffer<Api>>> for StagingBuffer<A>where
A: HalApi,
const TYPE: &'static str = "StagingBuffer"
fn as_info(&self) -> &ResourceInfo<Id<StagingBuffer<Api>>>
fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<StagingBuffer<Api>>>
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<Id<Surface>>
fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<Surface>>
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> Resource<Id<Texture<Api>>> for Texture<A>where
A: HalApi,
impl<A> Resource<Id<Texture<Api>>> for Texture<A>where
A: HalApi,
const TYPE: &'static str = "Texture"
fn as_info(&self) -> &ResourceInfo<Id<Texture<Api>>>
fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<Texture<Api>>>
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> Resource<Id<TextureView<Api>>> for TextureView<A>where
A: HalApi,
impl<A> Resource<Id<TextureView<Api>>> for TextureView<A>where
A: HalApi,
const TYPE: &'static str = "TextureView"
fn as_info(&self) -> &ResourceInfo<Id<TextureView<Api>>>
fn as_info_mut(&mut self) -> &mut ResourceInfo<Id<TextureView<Api>>>
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> 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> 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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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§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.Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more