Struct nvml_wrapper::unit::Unit
[−]
[src]
pub struct Unit<'nvml> { /* fields omitted */ }
Struct that represents a unit.
Obtain a Unit
with the various methods available to you on the NVML
struct.
I don't know what a unit is, but inferring from the docs leads me to believe it's some kind of high-end something-or-other that 99% of users won't know about either. That being said, I'm wrapping this whole library, so here you go.
Rust's lifetimes will ensure that the NVML instance this Unit
was created from
is not allowed to be shutdown until this Unit
is dropped, meaning you shouldn't
have to worry about calls returning Uninitialized
errors.
Methods
impl<'nvml> Unit<'nvml>
[src]
fn devices(&self) -> Result<Vec<Device>>
Gets the set of GPU devices that are attached to this Unit
.
I do not have the hardware to test this call. Verify for yourself that it works before you use it. If it works, please let me know; if it doesn't, I would love a PR. If NVML is sane this should work, but NVIDIA's docs on this call are anything but clear.
Errors
Uninitialized
, if the library has not been successfully initializedInvalidArg
, if the unit is invalidUnknown
, on any unexpected error
Device Support
For S-class products.
fn device_count(&self) -> Result<u32>
Gets the count of GPU devices that are attached to this Unit
.
I do not have the hardware to test this call. Verify for yourself that it works before you use it. If it works, please let me know; if it doesn't, I would love a PR. If NVML is sane this should work, but NVIDIA's docs on this call are anything but clear.
Errors
Uninitialized
, if the library has not been successfully initializedInvalidArg
, if the unit is invalidUnknown
, on any unexpected error
Device Support
For S-class products.
fn fan_info(&self) -> Result<FansInfo>
Gets fan information for this Unit
(fan count and state + speed for each).
Errors
Uninitialized
, if the library has not been successfully initializedInvalidArg
, if the unit is invalidNotSupported
, if this is not an S-class productUnknown
, on any unexpected error
Device Support
For S-class products.
fn led_state(&self) -> Result<LedState>
Gets the LED state associated with this Unit
.
Errors
Uninitialized
, if the library has not been successfully initializedInvalidArg
, if the unit is invalidNotSupported
, if this is not an S-class productUtf8Error
, if the string obtained from the C function is not valid Utf8Unknown
, on any unexpected error
Device Support
For S-class products.
fn psu_info(&self) -> Result<PsuInfo>
Gets the PSU stats for this Unit
.
Errors
Uninitialized
, if the library has not been successfully initializedInvalidArg
, if the unit is invalidNotSupported
, if this is not an S-class productUtf8Error
, if the string obtained from the C function is not valid Utf8Unknown
, on any unexpected error
Device Support
For S-class products.
fn temperature(&self, reading_type: TemperatureReading) -> Result<u32>
Gets the temperature for the specified UnitTemperatureReading
, in °C.
Available readings depend on the product.
Errors
Uninitialized
, if the library has not been successfully initializedInvalidArg
, if the unit is invalidNotSupported
, if this is not an S-class productUnknown
, on any unexpected error
Device Support
For S-class products. Available readings depend on the product.
fn info(&self) -> Result<UnitInfo>
Gets the static information associated with this Unit
.
Errors
Uninitialized
, if the library has not been successfully initializedInvalidArg
, if the unit is invalidUtf8Error
, if the string obtained from the C function is not valid Utf8
Device Support
For S-class products.
fn set_led_color(&mut self, color: LedColor) -> Result<()>
Sets the LED color for this Unit
.
Requires root/admin permissions. This operation takes effect immediately.
Note: Current S-class products don't provide unique LEDs for each unit. As such,
both front and back LEDs will be toggled in unison regardless of which unit is
specified with this method (aka the Unit
represented by this struct).
Errors
Uninitialized
, if the library has not been successfully initializedInvalidArg
, if the unit is invalidNotSupported
, if this is not an S-class productNoPermission
, if the user doesn't have permission to perform this operationUnknown
, on any unexpected error
Device Support
For S-class products.
fn into_raw(self) -> nvmlUnit_t
Consume the struct and obtain the raw unit handle that it contains.
fn as_raw(&self) -> &nvmlUnit_t
Obtain a reference to the raw unit handle contained in the struct.
fn as_mut_raw(&mut self) -> &mut nvmlUnit_t
Obtain a mutable reference to the raw unit handle contained in the struct.
unsafe fn unsafe_raw(&self) -> nvmlUnit_t
Sometimes necessary for C interop. Use carefully.
Trait Implementations
impl<'nvml> Debug for Unit<'nvml>
[src]
impl<'nvml> Send for Unit<'nvml>
[src]
impl<'nvml> Sync for Unit<'nvml>
[src]
impl<'nvml> From<nvmlUnit_t> for Unit<'nvml>
[src]
fn from(unit: nvmlUnit_t) -> Self
Performs the conversion.