#[repr(transparent)]pub struct Id<T>(_, _);
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<'de, T> Deserialize<'de> for Id<T>
impl<'de, T> Deserialize<'de> for Id<T>
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl<T> Ord for Id<T>
impl<T> Ord for Id<T>
source§impl<T> PartialEq<Id<T>> for Id<T>
impl<T> PartialEq<Id<T>> for Id<T>
source§impl<T> PartialOrd<Id<T>> for Id<T>
impl<T> PartialOrd<Id<T>> for Id<T>
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 moreimpl<T> Copy for Id<T>
impl<T> Eq for Id<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for Id<T>where T: RefUnwindSafe,
impl<T> Send for Id<T>where T: Send,
impl<T> Sync for Id<T>where T: Sync,
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> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.