CmdTimer

Struct CmdTimer 

Source
pub struct CmdTimer {
    pub time: Duration,
    pub activation: Option<Command>,
    pub abortion: Option<Command>,
    pub deactivation: Option<Command>,
    pub disabled: bool,
    pub activation_child: Option<Child>,
}
Expand description

A simple timer that runs a binary executable after a certain amount of time

Fields§

§time: Duration

The idle time required for this timer to activate

§activation: Option<Command>

The command, if any, to run upon activation

§abortion: Option<Command>

The command, if any, to run upon abortion

§deactivation: Option<Command>

The command, if any, to run upon deactivation

§disabled: bool

Whether or not to disable this timer

§activation_child: Option<Child>

The child process that is currently running

Trait Implementations§

Source§

impl Debug for CmdTimer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CmdTimer

Source§

fn default() -> CmdTimer

Returns the “default value” for a type. Read more
Source§

impl Timer for CmdTimer

Source§

fn time_left(&mut self, idle_time: Duration) -> Result<Option<Duration>>

Return the time left based on the relative idle time
Source§

fn abort_urgency(&self) -> Option<Duration>

How urgent this timer wants to be notified on abort (when the user is no longer idle). Return as slow of a duration as you think is acceptable to be nice to the CPU - preferrably return None which basically means infinity.
Source§

fn activate(&mut self) -> Result<()>

Called when the timer was activated
Source§

fn abort(&mut self) -> Result<()>

Called when the timer was aborted early - such as when the user moves their mouse or otherwise stops being idle.
Source§

fn deactivate(&mut self) -> Result<()>

Called when another timer was activated after this one
Source§

fn disabled(&mut self) -> bool

Return true if the timer is disabled and should be skipped. Changes to this value are reflected - you may enable a timer that was previously disabled, and xidlehook will call it as soon as the timer is passed - or immediately if the timer has already passed.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.