pub struct DeviceCapabilities {
pub device_type: DeviceType,
pub is_available: bool,
pub device_name: String,
pub memory_total_bytes: Option<u64>,
pub memory_free_bytes: Option<u64>,
pub compute_capability: Option<String>,
pub supports_fp16: bool,
pub supports_bf16: bool,
pub supports_int8: bool,
}Expand description
Rich capability description for a single DeviceType.
Produced by DeviceCapabilities::probe. Fields are populated
best-effort — anything the backend does not expose is left as None /
false, which lets callers use a single code path regardless of how
much telemetry the driver provides.
Fields§
§device_type: DeviceTypeWhich device this record describes.
is_available: boolWhether the device is currently available for inference.
device_name: StringHuman-facing device name (e.g. “CPU (x86_64)”, “NVIDIA GPU via CUDA”).
memory_total_bytes: Option<u64>Total device memory in bytes, if known.
memory_free_bytes: Option<u64>Free device memory in bytes, if known.
compute_capability: Option<String>Compute capability string (e.g. “8.6” for Ampere). None for CPU
/ WebGPU / DirectML / CoreML.
supports_fp16: boolWhether FP16 (half-precision float) is supported.
supports_bf16: boolWhether BF16 (bfloat16) is supported.
supports_int8: boolWhether INT8 quantised inference is supported.
Implementations§
Source§impl DeviceCapabilities
impl DeviceCapabilities
Sourcepub fn probe(device: DeviceType) -> Self
pub fn probe(device: DeviceType) -> Self
Probe a specific device and describe its capabilities.
Always returns a record; unavailable devices get is_available = false with the rest populated from static knowledge.
Sourcepub fn probe_all() -> Vec<Self>
pub fn probe_all() -> Vec<Self>
Probe every DeviceType variant and return a record per device.
The resulting vector has exactly DeviceType::all_variants entries
and is ordered to match that array.
Sourcepub fn best_available() -> Self
pub fn best_available() -> Self
Return capabilities for the best currently-available device.
Equivalent to DeviceCapabilities::probe(DeviceType::auto()), but
exposed as a named constructor for callers that only need the
capability record.
Trait Implementations§
Source§impl Clone for DeviceCapabilities
impl Clone for DeviceCapabilities
Source§fn clone(&self) -> DeviceCapabilities
fn clone(&self) -> DeviceCapabilities
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DeviceCapabilities
impl Debug for DeviceCapabilities
Source§impl Default for DeviceCapabilities
impl Default for DeviceCapabilities
Source§fn default() -> DeviceCapabilities
fn default() -> DeviceCapabilities
Source§impl Display for DeviceCapabilities
impl Display for DeviceCapabilities
impl Eq for DeviceCapabilities
Source§impl PartialEq for DeviceCapabilities
impl PartialEq for DeviceCapabilities
Source§fn eq(&self, other: &DeviceCapabilities) -> bool
fn eq(&self, other: &DeviceCapabilities) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for DeviceCapabilities
Auto Trait Implementations§
impl Freeze for DeviceCapabilities
impl RefUnwindSafe for DeviceCapabilities
impl Send for DeviceCapabilities
impl Sync for DeviceCapabilities
impl Unpin for DeviceCapabilities
impl UnsafeUnpin for DeviceCapabilities
impl UnwindSafe for DeviceCapabilities
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<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> 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