use std::cmp::Ordering;
use crate::{GpuInner, PCI};
pub struct Gpu {
pub(crate) inner: GpuInner,
}
impl PartialEq for Gpu {
fn eq(&self, other: &Self) -> bool {
self.pci() == other.pci()
}
}
impl Eq for Gpu {}
impl PartialOrd for Gpu {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl Ord for Gpu {
fn cmp(&self, other: &Self) -> Ordering {
self.pci().cmp(other.pci())
}
}
impl Gpu {
pub fn pci(&self) -> &PCI {
self.inner.pci()
}
pub fn vendor(&self) -> Option<&str> {
self.inner.vendor()
}
pub fn model(&self) -> Option<&str> {
self.inner.model()
}
pub fn usage(&self) -> Option<f32> {
self.inner.usage()
}
pub fn total_memory(&self) -> Option<u64> {
self.inner.total_memory()
}
pub fn used_memory(&self) -> Option<u64> {
self.inner.used_memory()
}
}