[−][src]Struct rustbatch::entities::timer::Timer
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]
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,
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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,