mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
37 lines
874 B
Rust
37 lines
874 B
Rust
use std::error::Error;
|
|
use std::fmt;
|
|
use std::fmt::{Debug, Display};
|
|
|
|
#[derive(PartialEq)]
|
|
pub(crate) enum AuraError {
|
|
ParseColour,
|
|
ParseSpeed,
|
|
ParseDirection,
|
|
ParseBrightness,
|
|
}
|
|
|
|
impl Debug for AuraError {
|
|
#[inline]
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
Display::fmt(self.description(), f)
|
|
}
|
|
}
|
|
|
|
impl Display for AuraError {
|
|
#[inline]
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
Display::fmt(self.description(), f)
|
|
}
|
|
}
|
|
|
|
impl Error for AuraError {
|
|
fn description(&self) -> &str {
|
|
match self {
|
|
AuraError::ParseColour => "could not parse colour",
|
|
AuraError::ParseSpeed => "could not parse speed",
|
|
AuraError::ParseDirection => "could not parse direction",
|
|
AuraError::ParseBrightness => "could not parse brightness",
|
|
}
|
|
}
|
|
}
|