Struct time::timer::ThreadSafeTimer
source · pub struct ThreadSafeTimer(/* private fields */);Available on crate feature
server only.Expand description
Thread safe version of the Timer.
The server does not manipulate directly the Timer, it uses
this thread safe version instead (mainly because the timer runs in
a std::thread::spawn loop).
Implementations§
source§impl ThreadSafeTimer
impl ThreadSafeTimer
pub fn new(config: TimerConfig) -> Result<Self>
pub fn with_timer<T>( &self, run: impl Fn(MutexGuard<'_, Timer>) -> Result<T> ) -> Result<T>
pub fn update(&self) -> Result<()>
pub fn start(&self) -> Result<()>
pub fn get(&self) -> Result<Timer>
pub fn set(&self, duration: usize) -> Result<()>
pub fn pause(&self) -> Result<()>
pub fn resume(&self) -> Result<()>
pub fn stop(&self) -> Result<()>
Trait Implementations§
source§impl Clone for ThreadSafeTimer
impl Clone for ThreadSafeTimer
source§fn clone(&self) -> ThreadSafeTimer
fn clone(&self) -> ThreadSafeTimer
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for ThreadSafeTimer
impl Debug for ThreadSafeTimer
source§impl Default for ThreadSafeTimer
impl Default for ThreadSafeTimer
source§fn default() -> ThreadSafeTimer
fn default() -> ThreadSafeTimer
Returns the “default value” for a type. Read more
source§impl Deref for ThreadSafeTimer
impl Deref for ThreadSafeTimer
Auto Trait Implementations§
impl RefUnwindSafe for ThreadSafeTimer
impl Send for ThreadSafeTimer
impl Sync for ThreadSafeTimer
impl Unpin for ThreadSafeTimer
impl UnwindSafe for ThreadSafeTimer
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more