Skip to main content

GpuId

Struct GpuId 

Source
pub struct GpuId {
    pub permanent: PermanentGpuId,
    pub session: Option<SessionGpuId>,
}
Expand description

The identity of an adapter, for GpuPreference::Device.

It is two facts, not one. permanent is what a config stores and what should still name the same hardware after a restart; session is what the backend can match in this process. A per-process handle (a LUID, a Metal registry id, a DRM node) does not survive a reboot, and a PCI pair does not distinguish two identical cards — so neither alone is a complete identity.

The permanent part is serialised; the session is not, because a config cannot know it.

Fields§

§permanent: PermanentGpuId

What survives a restart, where the platform has anything that does.

§session: Option<SessionGpuId>

The backend’s handle for this adapter in this process. None for a stored id.

Implementations§

Source§

impl GpuId

Source

pub const fn by_device(device_id: u32) -> GpuId

A GpuId matched on the PCI device id alone, with no session.

This is what ZED_DEVICE_ID lowers to: the variable names a device only, so the vendor is left open and the permanent part is the whole preference.

Source

pub const fn pci(vendor_id: u32, device_id: u32) -> GpuId

The permanent and session identity of a PCI adapter.

Source

pub const fn single() -> GpuId

The identity of the one adapter on a single-GPU platform.

Source

pub fn matches(&self, adapter: &GpuAdapterInfo) -> bool

Whether adapter is the one this id names.

A session is the stronger claim: when it is present, only the adapter with that session matches. Without one — a config, or a caller that knows only the model — the permanent part decides, and two identical cards both match.

Source

pub fn parse_pci_id(value: &str) -> Option<u32>

Parse a four-hex-digit PCI device id, such as a debug override carries.

The id is hexadecimal; a decimal-looking value such as 6422 parses as the hex 0x6422, matches nothing, and silently falls through to the default adapter.

Trait Implementations§

Source§

impl Clone for GpuId

Source§

fn clone(&self) -> GpuId

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for GpuId

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for GpuId

Source§

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

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

impl Eq for GpuId

Source§

impl PartialEq for GpuId

Source§

fn eq(&self, other: &GpuId) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for GpuId

Source§

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
Source§

impl StructuralPartialEq for GpuId

Auto Trait Implementations§

§

impl Freeze for GpuId

§

impl RefUnwindSafe for GpuId

§

impl Send for GpuId

§

impl Sync for GpuId

§

impl Unpin for GpuId

§

impl UnsafeUnpin for GpuId

§

impl UnwindSafe for GpuId

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
Source§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> CustomStyleProperty for T
where T: 'static + Send + Sync + PartialEq,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Upcasts to Any so CustomStyles::get can recover the concrete type.
Source§

fn eq_property(&self, other: &(dyn CustomStyleProperty + 'static)) -> bool

Compares two properties that share a concrete type.
Source§

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

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

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

Source§

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

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

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

Source§

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

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>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more