mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Partial daemon mode for builtin LED control
This commit is contained in:
36
src/error.rs
Normal file
36
src/error.rs
Normal file
@@ -0,0 +1,36 @@
|
||||
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",
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user