Struct xidlehook_core::timers::CallbackTimer[][src]

pub struct CallbackTimer<F> where
    F: FnMut(), 
{ pub disabled: bool, // some fields omitted }

A timer that lets you easily execute a rust callback on activation

Fields

disabled: bool

Whether or not to disable this timer

Implementations

impl<'a> CallbackTimer<Box<dyn FnMut() + 'a>>[src]

pub fn new<F>(time: Duration, f: F) -> Self where
    F: FnMut() + 'a, 
[src]

Create a new instance, which boxes the closure to a dynamic type. Use new_unboxed to use static dispatch, although keep in mind this will potentially make you unable to register more than one type of callback timer due to its static type.

impl<F> CallbackTimer<F> where
    F: FnMut(), 
[src]

pub fn new_unboxed(time: Duration, f: F) -> Self[src]

Create a new unboxed instance. Due to it’s static type, only one type can be used. This means that registering 2 timers with 2 different callbacks will conflict. An easy way to bypass this is using the new function, which behind the scenes just wraps the callback in a Box.

TL;DR: Don’t use this unless you’re planning on using another means of dynamic dispatch (an enum?) or if you’re a masochist.

Trait Implementations

impl<F: Debug> Debug for CallbackTimer<F> where
    F: FnMut(), 
[src]

impl<F> Timer for CallbackTimer<F> where
    F: FnMut(), 
[src]

Auto Trait Implementations

impl<F> RefUnwindSafe for CallbackTimer<F> where
    F: RefUnwindSafe

impl<F> Send for CallbackTimer<F> where
    F: Send

impl<F> Sync for CallbackTimer<F> where
    F: Sync

impl<F> Unpin for CallbackTimer<F> where
    F: Unpin

impl<F> UnwindSafe for CallbackTimer<F> where
    F: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.