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