pub struct PciInfo {
    pub bus: u32,
    pub bus_id: String,
    pub device: u32,
    pub domain: u32,
    pub pci_device_id: u32,
    pub pci_sub_system_id: Option<u32>,
}
Expand description

PCI information about a GPU device.

Fields§

§bus: u32

The bus on which the device resides, 0 to 0xff.

§bus_id: String

The PCI identifier.

§device: u32

The device’s ID on the bus, 0 to 31.

§domain: u32

The PCI domain on which the device’s bus resides, 0 to 0xffff.

§pci_device_id: u32

The combined 16-bit device ID and 16-bit vendor ID.

§pci_sub_system_id: Option<u32>

The 32-bit Sub System Device ID.

Will always be None if this PciInfo was obtained from NvLink.remote_pci_info(). NVIDIA says that the C field that this corresponds to “is not filled … and is indeterminate” when being returned from that specific call.

Will be Some in all other cases.

Implementations§

source§

impl PciInfo

source

pub fn try_from( struct_: nvmlPciInfo_t, sub_sys_id_present: bool ) -> Result<Self, NvmlError>

Try to create this struct from its C equivalent.

Passing false for sub_sys_id_present will set the pci_sub_system_id field to None. See the field docs for more.

§Errors
  • Utf8Error, if the string obtained from the C function is not valid Utf8

Trait Implementations§

source§

impl Clone for PciInfo

source§

fn clone(&self) -> PciInfo

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for PciInfo

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for PciInfo

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for PciInfo

source§

fn eq(&self, other: &PciInfo) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl TryInto<nvmlPciInfo_st> for PciInfo

source§

fn try_into(self) -> Result<nvmlPciInfo_t, Self::Error>

Convert this PciInfo back into its C equivalent.

§Errors
  • NulError, if a nul byte was found in the bus_id (shouldn’t occur?)
  • StringTooLong, if bus_id.len() exceeded the length of NVML_DEVICE_PCI_BUS_ID_BUFFER_SIZE. This should (?) only be able to occur if the user modifies bus_id in some fashion. We return an error rather than panicking.
§

type Error = NvmlError

The type returned in the event of a conversion error.
source§

impl Eq for PciInfo

source§

impl StructuralPartialEq for PciInfo

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.