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 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> PartialOrd for Id<T>where
T: Marker,
impl<T> PartialOrd for Id<T>where
T: Marker,
impl<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§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.