@@ -95,6 +95,7 @@ impl<'nvml> Device<'nvml> {
95
95
does not support the feature that is being queried (e.g. enabling/disabling auto
96
96
boosted clocks is not supported by this `Device`).
97
97
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
98
+ * `UnexpectedVariant`, for which you can read the docs for
98
99
* `Unknown`, on any unexpected error
99
100
100
101
# Device Support
@@ -108,7 +109,7 @@ impl<'nvml> Device<'nvml> {
108
109
let mut restricted_state: nvmlEnableState_t = mem:: zeroed ( ) ;
109
110
nvml_try ( nvmlDeviceGetAPIRestriction ( self . device , api. as_c ( ) , & mut restricted_state) ) ?;
110
111
111
- Ok ( bool_from_state ( restricted_state) )
112
+ Ok ( bool_from_state ( restricted_state) ? )
112
113
}
113
114
}
114
115
@@ -156,6 +157,7 @@ impl<'nvml> Device<'nvml> {
156
157
* `InvalidArg`, if the device is invalid
157
158
* `NotSupported`, if this `Device` does not support auto boosted clocks
158
159
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
160
+ * `UnexpectedVariant`, for which you can read the docs for
159
161
* `Unknown`, on any unexpected error
160
162
161
163
# Device Support
@@ -170,8 +172,8 @@ impl<'nvml> Device<'nvml> {
170
172
let mut is_enabled_default: nvmlEnableState_t = mem:: zeroed ( ) ;
171
173
nvml_try ( nvmlDeviceGetAutoBoostedClocksEnabled ( self . device , & mut is_enabled, & mut is_enabled_default) ) ?;
172
174
173
- Ok ( AutoBoostClocksEnabledInfo { is_enabled : bool_from_state ( is_enabled) ,
174
- is_enabled_default : bool_from_state ( is_enabled_default) } )
175
+ Ok ( AutoBoostClocksEnabledInfo { is_enabled : bool_from_state ( is_enabled) ? ,
176
+ is_enabled_default : bool_from_state ( is_enabled_default) ? } )
175
177
}
176
178
}
177
179
@@ -272,6 +274,7 @@ impl<'nvml> Device<'nvml> {
272
274
* `InvalidArg`, if the device is invalid
273
275
* `NotSupported`, if this `Device` does not support this feature
274
276
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
277
+ * `UnexpectedVariant`, for which you can read the docs for
275
278
* `Unknown`, on any unexpected error
276
279
277
280
# Device Support
@@ -285,7 +288,7 @@ impl<'nvml> Device<'nvml> {
285
288
let mut info: nvmlBridgeChipHierarchy_t = mem:: zeroed ( ) ;
286
289
nvml_try ( nvmlDeviceGetBridgeChipInfo ( self . device , & mut info) ) ?;
287
290
288
- Ok ( BridgeChipHierarchy :: from ( info) )
291
+ Ok ( BridgeChipHierarchy :: try_from ( info) ? )
289
292
}
290
293
}
291
294
@@ -449,8 +452,8 @@ impl<'nvml> Device<'nvml> {
449
452
450
453
// Passing null doesn't mean we want the count, it's just allowed
451
454
match nvmlDeviceGetComputeRunningProcesses ( self . device , & mut count, ptr:: null_mut ( ) ) {
452
- nvmlReturn_t :: NVML_SUCCESS => Ok ( 0 ) ,
453
- nvmlReturn_t :: NVML_ERROR_INSUFFICIENT_SIZE => Ok ( count) ,
455
+ nvmlReturn_enum_NVML_SUCCESS => Ok ( 0 ) ,
456
+ nvmlReturn_enum_NVML_ERROR_INSUFFICIENT_SIZE => Ok ( count) ,
454
457
// We know that this wil be an error
455
458
other => nvml_try ( other) . map ( |_| 0 ) ,
456
459
}
@@ -633,6 +636,7 @@ impl<'nvml> Device<'nvml> {
633
636
* `InvalidArg`, if the device is invalid
634
637
* `NotSupported`, if this `Device` does not support this feature
635
638
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
639
+ * `UnexpectedVariant`, for which you can read the docs for
636
640
* `Unknown`, on any unexpected error
637
641
*/
638
642
// Checked against local
@@ -643,7 +647,7 @@ impl<'nvml> Device<'nvml> {
643
647
let mut state: nvmlEnableState_t = mem:: zeroed ( ) ;
644
648
nvml_try ( nvmlDeviceGetDisplayActive ( self . device , & mut state) ) ?;
645
649
646
- Ok ( bool_from_state ( state) )
650
+ Ok ( bool_from_state ( state) ? )
647
651
}
648
652
}
649
653
@@ -658,6 +662,7 @@ impl<'nvml> Device<'nvml> {
658
662
* `InvalidArg`, if the device is invalid
659
663
* `NotSupported`, if this `Device` does not support this feature
660
664
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
665
+ * `UnexpectedVariant`, for which you can read the docs for
661
666
* `Unknown`, on any unexpected error
662
667
*/
663
668
// Checked against local
@@ -668,7 +673,7 @@ impl<'nvml> Device<'nvml> {
668
673
let mut state: nvmlEnableState_t = mem:: zeroed ( ) ;
669
674
nvml_try ( nvmlDeviceGetDisplayMode ( self . device , & mut state) ) ?;
670
675
671
- Ok ( bool_from_state ( state) )
676
+ Ok ( bool_from_state ( state) ? )
672
677
}
673
678
}
674
679
@@ -717,6 +722,7 @@ impl<'nvml> Device<'nvml> {
717
722
* `InvalidArg`, if the device is invalid
718
723
* `NotSupported`, if this `Device` does not support this feature
719
724
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
725
+ * `UnexpectedVariant`, for which you can read the docs for
720
726
* `Unknown`, on any unexpected error
721
727
722
728
# Device Support
@@ -732,8 +738,8 @@ impl<'nvml> Device<'nvml> {
732
738
let mut pending: nvmlEnableState_t = mem:: zeroed ( ) ;
733
739
nvml_try ( nvmlDeviceGetEccMode ( self . device , & mut current, & mut pending) ) ?;
734
740
735
- Ok ( EccModeState { currently_enabled : bool_from_state ( current) ,
736
- pending_enabled : bool_from_state ( pending) } )
741
+ Ok ( EccModeState { currently_enabled : bool_from_state ( current) ? ,
742
+ pending_enabled : bool_from_state ( pending) ? } )
737
743
}
738
744
}
739
745
@@ -831,6 +837,7 @@ impl<'nvml> Device<'nvml> {
831
837
* `InvalidArg`, if the device is invalid
832
838
* `NotSupported`, if this `Device` does not support this feature
833
839
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
840
+ * `UnexpectedVariant`, for which you can read the docs for
834
841
* `Unknown`, on any unexpected error
835
842
836
843
# Device Support
@@ -847,8 +854,8 @@ impl<'nvml> Device<'nvml> {
847
854
let mut pending: nvmlGpuOperationMode_t = mem:: zeroed ( ) ;
848
855
nvml_try ( nvmlDeviceGetGpuOperationMode ( self . device , & mut current, & mut pending) ) ?;
849
856
850
- Ok ( OperationModeState { current : current . into ( ) ,
851
- pending : pending . into ( ) } )
857
+ Ok ( OperationModeState { current : OperationMode :: try_from ( current ) ? ,
858
+ pending : OperationMode :: try_from ( pending ) ? } )
852
859
}
853
860
}
854
861
@@ -892,6 +899,7 @@ impl<'nvml> Device<'nvml> {
892
899
* `Uninitialized`, if the library has not been successfully initialized
893
900
* `InvalidArg`, if the device is invalid
894
901
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
902
+ * `UnexpectedVariant`, for which you can read the docs for
895
903
* `Unknown`, on any unexpected error
896
904
*/
897
905
// Tested as part of `.running_graphics_processes()`
@@ -903,8 +911,8 @@ impl<'nvml> Device<'nvml> {
903
911
904
912
// Passing null doesn't indicate that we want the count. It's just allowed.
905
913
match nvmlDeviceGetGraphicsRunningProcesses ( self . device , & mut count, ptr:: null_mut ( ) ) {
906
- nvmlReturn_t :: NVML_SUCCESS => Ok ( 0 ) ,
907
- nvmlReturn_t :: NVML_ERROR_INSUFFICIENT_SIZE => Ok ( count) ,
914
+ nvmlReturn_enum_NVML_SUCCESS => Ok ( 0 ) ,
915
+ nvmlReturn_enum_NVML_ERROR_INSUFFICIENT_SIZE => Ok ( count) ,
908
916
// We know that this will be an error
909
917
other => nvml_try ( other) . map ( |_| 0 ) ,
910
918
}
@@ -1361,6 +1369,7 @@ impl<'nvml> Device<'nvml> {
1361
1369
* `InvalidArg`, if the device is invalid
1362
1370
* `NotSupported`, if this `Device` does not support this feature
1363
1371
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
1372
+ * `UnexpectedVariant`, for which you can read the docs for
1364
1373
* `Unknown`, on any unexpected error
1365
1374
1366
1375
# Device Support
@@ -1374,7 +1383,7 @@ impl<'nvml> Device<'nvml> {
1374
1383
let mut state: nvmlPstates_t = mem:: zeroed ( ) ;
1375
1384
nvml_try ( nvmlDeviceGetPerformanceState ( self . device , & mut state) ) ?;
1376
1385
1377
- Ok ( state . into ( ) )
1386
+ Ok ( PerformanceState :: try_from ( state ) ? )
1378
1387
}
1379
1388
}
1380
1389
@@ -1389,6 +1398,7 @@ impl<'nvml> Device<'nvml> {
1389
1398
* `InvalidArg`, if the device is invalid
1390
1399
* `NotSupported`, if this `Device` does not support this feature
1391
1400
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
1401
+ * `UnexpectedVariant`, for which you can read the docs for
1392
1402
* `Unknown`, on any unexpected error
1393
1403
1394
1404
# Platform Support
@@ -1403,7 +1413,7 @@ impl<'nvml> Device<'nvml> {
1403
1413
let mut state: nvmlEnableState_t = mem:: zeroed ( ) ;
1404
1414
nvml_try ( nvmlDeviceGetPersistenceMode ( self . device , & mut state) ) ?;
1405
1415
1406
- Ok ( bool_from_state ( state) )
1416
+ Ok ( bool_from_state ( state) ? )
1407
1417
}
1408
1418
}
1409
1419
@@ -1504,7 +1514,7 @@ impl<'nvml> Device<'nvml> {
1504
1514
let mut state: nvmlEnableState_t = mem:: zeroed ( ) ;
1505
1515
nvml_try ( nvmlDeviceGetPowerManagementMode ( self . device , & mut state) ) ?;
1506
1516
1507
- Ok ( bool_from_state ( state) )
1517
+ Ok ( bool_from_state ( state) ? )
1508
1518
}
1509
1519
}
1510
1520
@@ -1517,7 +1527,7 @@ impl<'nvml> Device<'nvml> {
1517
1527
let mut state: nvmlPstates_t = mem:: zeroed ( ) ;
1518
1528
nvml_try ( nvmlDeviceGetPowerState ( self . device , & mut state) ) ?;
1519
1529
1520
- Ok ( state . into ( ) )
1530
+ Ok ( PerformanceState :: try_from ( state ) ? )
1521
1531
}
1522
1532
}
1523
1533
@@ -1617,6 +1627,7 @@ impl<'nvml> Device<'nvml> {
1617
1627
* `InvalidArg`, if the device is invalid
1618
1628
* `NotSupported`, if this `Device` doesn't support this feature
1619
1629
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
1630
+ * `UnexpectedVariant`, for which you can read the docs for
1620
1631
* `Unknown`, on any unexpected error
1621
1632
1622
1633
# Device Support
@@ -1630,7 +1641,7 @@ impl<'nvml> Device<'nvml> {
1630
1641
let mut state: nvmlEnableState_t = mem:: zeroed ( ) ;
1631
1642
nvml_try ( nvmlDeviceGetRetiredPagesPendingStatus ( self . device , & mut state) ) ?;
1632
1643
1633
- Ok ( bool_from_state ( state) )
1644
+ Ok ( bool_from_state ( state) ? )
1634
1645
}
1635
1646
}
1636
1647
@@ -1890,7 +1901,7 @@ impl<'nvml> Device<'nvml> {
1890
1901
for_mem_clock,
1891
1902
& mut count,
1892
1903
items. as_mut_ptr ( ) ) {
1893
- nvmlReturn_t :: NVML_ERROR_INSUFFICIENT_SIZE =>
1904
+ nvmlReturn_enum_NVML_ERROR_INSUFFICIENT_SIZE =>
1894
1905
// `count` is now the size that is required. Return it in the error.
1895
1906
bail ! ( ErrorKind :: InsufficientSize ( count as usize ) ) ,
1896
1907
value => nvml_try ( value) ?,
@@ -1937,7 +1948,7 @@ impl<'nvml> Device<'nvml> {
1937
1948
match nvmlDeviceGetSupportedMemoryClocks ( self . device ,
1938
1949
& mut count,
1939
1950
items. as_mut_ptr ( ) ) {
1940
- nvmlReturn_t :: NVML_ERROR_INSUFFICIENT_SIZE =>
1951
+ nvmlReturn_enum_NVML_ERROR_INSUFFICIENT_SIZE =>
1941
1952
// `count` is now the size that is required. Return it in the error.
1942
1953
bail ! ( ErrorKind :: InsufficientSize ( count as usize ) ) ,
1943
1954
value => nvml_try ( value) ?,
@@ -2001,6 +2012,7 @@ impl<'nvml> Device<'nvml> {
2001
2012
# Errors
2002
2013
* `InvalidArg`, if either `Device` is invalid
2003
2014
* `NotSupported`, if this `Device` or the OS does not support this feature
2015
+ * `UnexpectedVariant`, for which you can read the docs for
2004
2016
* `Unknown`, an error has occurred in the underlying topology discovery
2005
2017
2006
2018
# Platform Support
@@ -2015,7 +2027,7 @@ impl<'nvml> Device<'nvml> {
2015
2027
let mut level: nvmlGpuTopologyLevel_t = mem:: zeroed ( ) ;
2016
2028
nvml_try ( nvmlDeviceGetTopologyCommonAncestor ( self . device , other_device. device , & mut level) ) ?;
2017
2029
2018
- Ok ( level . into ( ) )
2030
+ Ok ( TopologyLevel :: try_from ( level ) ? )
2019
2031
}
2020
2032
}
2021
2033
@@ -2493,6 +2505,7 @@ impl<'nvml> Device<'nvml> {
2493
2505
* `Uninitialized`, if the library has not been successfully initialized
2494
2506
* `InvalidArg`, if the `Device` is invalid
2495
2507
* `NotSupported`, if this `Device` does not support this feature
2508
+ * `UnexpectedVariant`, for which you can read the docs for
2496
2509
* `Unknown`, on any unexpected error
2497
2510
2498
2511
# Device Support
@@ -2506,7 +2519,7 @@ impl<'nvml> Device<'nvml> {
2506
2519
let mut state: nvmlEnableState_t = mem:: zeroed ( ) ;
2507
2520
nvml_try ( nvmlDeviceGetAccountingMode ( self . device , & mut state) ) ?;
2508
2521
2509
- Ok ( bool_from_state ( state) )
2522
+ Ok ( bool_from_state ( state) ? )
2510
2523
}
2511
2524
}
2512
2525
@@ -2549,9 +2562,9 @@ impl<'nvml> Device<'nvml> {
2549
2562
// Null also indicates that we want the count
2550
2563
match nvmlDeviceGetAccountingPids ( self . device , & mut count, ptr:: null_mut ( ) ) {
2551
2564
// List is empty
2552
- nvmlReturn_t :: NVML_SUCCESS => Ok ( 0 ) ,
2565
+ nvmlReturn_enum_NVML_SUCCESS => Ok ( 0 ) ,
2553
2566
// Count is set to pids count
2554
- nvmlReturn_t :: NVML_ERROR_INSUFFICIENT_SIZE => Ok ( count) ,
2567
+ nvmlReturn_enum_NVML_ERROR_INSUFFICIENT_SIZE => Ok ( count) ,
2555
2568
// We know this is an error
2556
2569
other => nvml_try ( other) . map ( |_| 0 ) ,
2557
2570
}
@@ -3178,6 +3191,7 @@ impl<'nvml> Device<'nvml> {
3178
3191
* `Uninitialized`, if the library has not been successfully initialized
3179
3192
* `NotSupported`, if this `Device` doesn't support this feature
3180
3193
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
3194
+ * `UnexpectedVariant`, for which you can read the docs for
3181
3195
* `Unknown`, on any unexpected error
3182
3196
3183
3197
In addition, all of the errors returned by:
@@ -3229,7 +3243,7 @@ impl<'nvml> Device<'nvml> {
3229
3243
let mut state: nvmlEnableState_t = mem:: zeroed ( ) ;
3230
3244
nvml_try ( nvmlDeviceQueryDrainState ( & mut pci_info. try_into_c ( ) ?, & mut state) ) ?;
3231
3245
3232
- Ok ( bool_from_state ( state) )
3246
+ Ok ( bool_from_state ( state) ? )
3233
3247
}
3234
3248
}
3235
3249
0 commit comments