nvml_wrapper/struct_wrappers/
mod.rs1pub mod device;
2pub mod event;
3pub mod nv_link;
4pub mod unit;
5
6use self::device::PciInfo;
7use crate::error::NvmlError;
8use crate::ffi::bindings::*;
9#[cfg(feature = "serde")]
10use serde_derive::{Deserialize, Serialize};
11use std::{convert::TryFrom, ffi::CStr};
12
13#[derive(Debug, Clone, Eq, PartialEq, Hash)]
15#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
16pub struct ExcludedDeviceInfo {
17 pci_info: PciInfo,
18 uuid: String,
19}
20
21impl TryFrom<nvmlExcludedDeviceInfo_t> for ExcludedDeviceInfo {
22 type Error = NvmlError;
23
24 fn try_from(value: nvmlExcludedDeviceInfo_t) -> Result<Self, Self::Error> {
32 unsafe {
33 let uuid_raw = CStr::from_ptr(value.uuid.as_ptr());
34
35 Ok(Self {
36 pci_info: PciInfo::try_from(value.pciInfo, true)?,
37 uuid: uuid_raw.to_str()?.into(),
38 })
39 }
40 }
41}