pub struct Id<T: Marker>(/* private fields */);
Expand description
An identifier for a wgpu object.
An Id<T>
value identifies a value stored in a Global
’s Hub
.
§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: Marker,
impl<T> Id<T>where
T: Marker,
source§impl Id<CommandEncoder>
impl Id<CommandEncoder>
pub fn into_command_buffer_id(self) -> CommandBufferId
source§impl Id<CommandBuffer>
impl Id<CommandBuffer>
pub fn into_command_encoder_id(self) -> CommandEncoderId
Trait Implementations§
source§impl<'de, T: Marker> Deserialize<'de> for Id<T>
impl<'de, T: Marker> 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>where
T: Marker,
impl<T> Ord for Id<T>where
T: Marker,
source§impl<T> PartialEq for Id<T>where
T: Marker,
impl<T> PartialEq for Id<T>where
T: Marker,
source§impl<T> PartialOrd for Id<T>where
T: Marker,
impl<T> PartialOrd for Id<T>where
T: Marker,
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>where
T: Marker,
impl<T> Eq for Id<T>where
T: Marker,
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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.