#[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
sourceimpl<T> Ord for Id<T>
impl<T> Ord for Id<T>
sourceimpl<T> PartialOrd<Id<T>> for Id<T>
impl<T> PartialOrd<Id<T>> for Id<T>
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
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 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn le(&self, other: &Rhs) -> bool
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
impl<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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.