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 async fn update(&self)
pub async fn start(&self) -> Result<()>
pub async fn get(&self) -> Timer
pub async fn set(&self, duration: usize) -> Result<()>
pub async fn pause(&self) -> Result<()>
pub async fn resume(&self) -> Result<()>
pub async 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 Freeze for ThreadSafeTimer
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