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: PermanentGpuIdWhat 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
impl GpuId
Sourcepub const fn by_device(device_id: u32) -> GpuId
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.
Sourcepub const fn pci(vendor_id: u32, device_id: u32) -> GpuId
pub const fn pci(vendor_id: u32, device_id: u32) -> GpuId
The permanent and session identity of a PCI adapter.
Sourcepub fn matches(&self, adapter: &GpuAdapterInfo) -> bool
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.
Sourcepub fn parse_pci_id(value: &str) -> Option<u32>
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<'de> Deserialize<'de> for GpuId
impl<'de> Deserialize<'de> for GpuId
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<GpuId, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<GpuId, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for GpuId
Source§impl Serialize for GpuId
impl Serialize for GpuId
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
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> 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§impl<T> CustomStyleProperty for T
impl<T> CustomStyleProperty for T
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Any so CustomStyles::get can recover the concrete type.Source§fn eq_property(&self, other: &(dyn CustomStyleProperty + 'static)) -> bool
fn eq_property(&self, other: &(dyn CustomStyleProperty + 'static)) -> bool
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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