[][src]Struct rustbatch::entities::timer::Timer

pub struct Timer<T: Send + 'static + Hash + Clone + Copy + Eq> { /* fields omitted */ }

Timer is for off-thread countdowns. It keeps whatever you input for a duration and then returns it.

Implementations

impl<T: Send + 'static + Hash + Clone + Copy + Eq> Timer<T>[src]

pub fn new(precision: u64) -> Self[src]

new creates timer thread that will countdown all tasks, precision determinate how frequent should countdown iterations should be. Passing 0 as precision results to very precise countdowns but thread will use CPU on 100%. Timer thread of cores terminates when you drop Timer.

pub fn countdown(&self, task: T, delay: f32)[src]

countdown starts countdown of task. It can be retrieved by polling after delay. Delay is in seconds.

pub fn poll(&self, collector: &mut Vec<T>)[src]

poll feeds collector with all finished tasks. Its like this because then you would have to allocate new vector every poll.

Auto Trait Implementations

impl<T> !RefUnwindSafe for Timer<T>

impl<T> Send for Timer<T>

impl<T> !Sync for Timer<T>

impl<T> Unpin for Timer<T>

impl<T> !UnwindSafe for Timer<T>

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,