Temporary checkpoint

This commit is contained in:
Luke D. Jones
2021-08-22 14:01:05 +12:00
parent 8fcd05c2bb
commit 0ed97db4c1
32 changed files with 553 additions and 2341 deletions

View File

@@ -1,18 +1,12 @@
use std::fmt;
use intel_pstate::PStateError;
use rog_fan_curve::CurveError;
#[derive(Debug)]
pub enum ProfileError {
ParseFanLevel,
Path(String, std::io::Error),
Read(String, std::io::Error),
Write(String, std::io::Error),
NotSupported,
NotFound(String),
IntelPstate(PStateError),
FanCurve(CurveError),
Io(std::io::Error),
//Zbus(zbus::Error),
}
@@ -21,14 +15,11 @@ impl fmt::Display for ProfileError {
// This trait requires `fmt` with this exact signature.
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
ProfileError::ParseFanLevel => write!(f, "Parse profile error"),
ProfileError::Path(path, error) => write!(f, "Path {}: {}", path, error),
ProfileError::Read(path, error) => write!(f, "Read {}: {}", path, error),
ProfileError::Write(path, error) => write!(f, "Write {}: {}", path, error),
ProfileError::NotSupported => write!(f, "Not supported"),
ProfileError::NotFound(deets) => write!(f, "Not found: {}", deets),
ProfileError::IntelPstate(err) => write!(f, "Intel pstate error: {}", err),
ProfileError::FanCurve(err) => write!(f, "Custom fan-curve error: {}", err),
ProfileError::Io(detail) => write!(f, "std::io error: {}", detail),
//Error::Zbus(detail) => write!(f, "Zbus error: {}", detail),
}
@@ -36,15 +27,3 @@ impl fmt::Display for ProfileError {
}
impl std::error::Error for ProfileError {}
impl From<PStateError> for ProfileError {
fn from(err: PStateError) -> Self {
ProfileError::IntelPstate(err)
}
}
impl From<CurveError> for ProfileError {
fn from(err: CurveError) -> Self {
ProfileError::FanCurve(err)
}
}