Begin rog-aura crate

This commit is contained in:
Luke D Jones
2021-04-11 18:50:57 +12:00
parent e9f1fa01fc
commit 6f36d91281
39 changed files with 665 additions and 84 deletions

26
rog-aura/src/error.rs Normal file
View File

@@ -0,0 +1,26 @@
use std::error;
use std::fmt;
#[derive(Debug)]
pub enum Error {
ParseColour,
ParseSpeed,
ParseDirection,
ParseBrightness,
ParseAnime,
}
impl fmt::Display for Error {
// This trait requires `fmt` with this exact signature.
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Error::ParseColour => write!(f, "Could not parse colour"),
Error::ParseSpeed => write!(f, "Could not parse speed"),
Error::ParseDirection => write!(f, "Could not parse direction"),
Error::ParseBrightness => write!(f, "Could not parse brightness"),
Error::ParseAnime => write!(f, "Could not parse anime"),
}
}
}
impl error::Error for Error {}