Struct wgpu::core::id::Id

pub struct Id<T>(/* private fields */)
where
    T: Marker;
Available on wgpu_core only.
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§

§

impl<T> Id<T>
where T: Marker,

pub unsafe fn from_raw(raw: RawId) -> Id<T>

Safety

The raw id must be valid for the type.

pub fn into_raw(self) -> RawId

Coerce the identifiers into its raw underlying representation.

pub fn backend(self) -> Backend

Get the backend this identifier corresponds to.

pub fn zip(index: u32, epoch: u32, backend: Backend) -> Id<T>

pub fn unzip(self) -> (u32, u32, Backend)

§

impl Id<CommandEncoder>

§

impl Id<CommandBuffer>

§

impl Id<Device>

pub fn into_queue_id(self) -> Id<Queue>

Trait Implementations§

§

impl<T> Clone for Id<T>
where T: Marker,

§

fn clone(&self) -> Id<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<T> Debug for Id<T>
where T: Marker,

§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<'de, T> Deserialize<'de> for Id<T>
where T: Marker,

§

fn deserialize<__D>( __deserializer: __D ) -> Result<Id<T>, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl<T> Hash for Id<T>
where T: Marker,

§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl<T> Ord for Id<T>
where T: Marker,

§

fn cmp(&self, other: &Id<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
§

impl<T> PartialEq for Id<T>
where T: Marker,

§

fn eq(&self, other: &Id<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<T> PartialOrd for Id<T>
where T: Marker,

§

fn partial_cmp(&self, other: &Id<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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 · source§

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
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl<T> Serialize for Id<T>
where T: Marker,

§

fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl<T> Copy for Id<T>
where T: Marker,

§

impl<T> Eq for Id<T>
where T: Marker,

Auto Trait Implementations§

§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<N> NodeTrait for N
where N: Copy + Ord + Hash,

source§

impl<T> WasmNotSend for T
where T: Send,

source§

impl<T> WasmNotSendSync for T

source§

impl<T> WasmNotSync for T
where T: Sync,