Struct time::ThreadSafeTimer
source · pub struct ThreadSafeTimer(/* private fields */);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>
Available on crate feature
server only.pub fn with_timer<T>( &self, run: impl Fn(MutexGuard<'_, Timer>) -> Result<T> ) -> Result<T>
Available on crate feature
server only.pub fn update(&self) -> Result<()>
Available on crate feature
server only.pub fn start(&self) -> Result<()>
Available on crate feature
server only.pub fn get(&self) -> Result<Timer>
Available on crate feature
server only.pub fn set(&self, duration: usize) -> Result<()>
Available on crate feature
server only.pub fn pause(&self) -> Result<()>
Available on crate feature
server only.pub fn resume(&self) -> Result<()>
Available on crate feature
server only.pub fn stop(&self) -> Result<()>
Available on crate feature
server only.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
Available on crate feature server only.
impl Deref for ThreadSafeTimer
Available on crate feature
server only.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