#[non_exhaustive]pub enum DetectionError {
ToolNotFound {
tool: String,
},
ToolFailed {
tool: String,
exit_code: Option<i32>,
stderr: String,
},
Timeout {
tool: String,
timeout_secs: f64,
},
ParseError {
backend: String,
message: String,
},
SysfsReadError {
path: String,
message: String,
},
}Expand description
An error encountered during hardware detection.
These are non-fatal — detection continues even when individual backends
fail. The registry collects them as crate::AcceleratorRegistry::warnings.
§Examples
use ai_hwaccel::DetectionError;
let err = DetectionError::ToolNotFound { tool: "nvidia-smi".into() };
assert!(err.to_string().contains("nvidia-smi"));
let err = DetectionError::Timeout { tool: "hl-smi".into(), timeout_secs: 5.0 };
assert!(err.to_string().contains("timed out"));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
ToolNotFound
A required CLI tool was not found on $PATH.
ToolFailed
A CLI tool was found but exited with a non-zero status.
Timeout
A CLI tool did not exit within the allowed timeout.
The process was killed. This is distinct from ToolFailed
to allow callers to implement retry logic for transient slowness.
ParseError
Output from a CLI tool or sysfs file could not be parsed.
SysfsReadError
A sysfs or procfs path could not be read.
Trait Implementations§
Source§impl Clone for DetectionError
impl Clone for DetectionError
Source§fn clone(&self) -> DetectionError
fn clone(&self) -> DetectionError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DetectionError
impl Debug for DetectionError
Source§impl<'de> Deserialize<'de> for DetectionError
impl<'de> Deserialize<'de> for DetectionError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for DetectionError
impl Display for DetectionError
Source§impl Error for DetectionError
impl Error for DetectionError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl PartialEq for DetectionError
impl PartialEq for DetectionError
Source§impl Serialize for DetectionError
impl Serialize for DetectionError
impl StructuralPartialEq for DetectionError
Auto Trait Implementations§
impl Freeze for DetectionError
impl RefUnwindSafe for DetectionError
impl Send for DetectionError
impl Sync for DetectionError
impl Unpin for DetectionError
impl UnsafeUnpin for DetectionError
impl UnwindSafe for DetectionError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more