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