use snafu::Snafu;
#[derive(Debug, Snafu)]
pub enum NoSleepError {
#[snafu(display("Could not initialize: {:?}", reason))]
Init { reason: String },
#[snafu(display("Could not prevent sleep: {:?}", reason))]
PreventSleep { reason: String },
#[snafu(display("DBus error: {:?}", reason))]
DBus { reason: String },
#[snafu(display("Could not stop lock: {:?}", reason))]
StopLock { reason: String },
}
pub trait NoSleepTrait {
fn new() -> Result<Self, NoSleepError>
where
Self: Sized;
fn prevent_display_sleep(&mut self) -> Result<(), NoSleepError>;
fn prevent_system_sleep(&mut self) -> Result<(), NoSleepError>;
fn stop(&mut self) -> Result<(), NoSleepError>;
}