Struct xidlehook_core::timers::CallbackTimer [−][src]
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]
F: FnMut() + 'a,
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]
F: FnMut(),
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]
F: FnMut(),
impl<F> Timer for CallbackTimer<F> where
F: FnMut(),
[src]
F: FnMut(),
Auto Trait Implementations
impl<F> RefUnwindSafe for CallbackTimer<F> where
F: RefUnwindSafe,
F: RefUnwindSafe,
impl<F> Send for CallbackTimer<F> where
F: Send,
F: Send,
impl<F> Sync for CallbackTimer<F> where
F: Sync,
F: Sync,
impl<F> Unpin for CallbackTimer<F> where
F: Unpin,
F: Unpin,
impl<F> UnwindSafe for CallbackTimer<F> where
F: UnwindSafe,
F: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,