pub struct Timer<R> { /* private fields */ }
Expand description
A timer suitable for use by actors.
Implementations§
Source§impl<R: SupportsTimers> Timer<R>
impl<R: SupportsTimers> Timer<R>
Sourcepub fn state(&self) -> TimerState
pub fn state(&self) -> TimerState
Get the state of the timer
Sourcepub fn set_interval_at_weak<T: Tick>(
&mut self,
addr: WeakAddr<T>,
start: Instant,
interval: Duration,
)
pub fn set_interval_at_weak<T: Tick>( &mut self, addr: WeakAddr<T>, start: Instant, interval: Duration, )
Configure the timer to tick at a set interval with an initial delay. The timer will not try to keep the actor alive.
Sourcepub fn set_interval_at_strong<T: Tick>(
&mut self,
addr: Addr<T>,
start: Instant,
interval: Duration,
)
pub fn set_interval_at_strong<T: Tick>( &mut self, addr: Addr<T>, start: Instant, interval: Duration, )
Configure the timer to tick at a set interval with an initial delay. The timer will try to keep the actor alive.
Sourcepub fn set_interval_weak<T: Tick>(
&mut self,
addr: WeakAddr<T>,
interval: Duration,
)
pub fn set_interval_weak<T: Tick>( &mut self, addr: WeakAddr<T>, interval: Duration, )
Configure the timer to tick at a set interval, with the initial tick sent immediately. The timer will not try to keep the actor alive.
Sourcepub fn set_interval_strong<T: Tick>(
&mut self,
addr: Addr<T>,
interval: Duration,
)
pub fn set_interval_strong<T: Tick>( &mut self, addr: Addr<T>, interval: Duration, )
Configure the timer to tick at a set interval, with the initial tick sent immediately. The timer will try to keep the actor alive.
Sourcepub fn set_timeout_weak<T: Tick>(
&mut self,
addr: WeakAddr<T>,
deadline: Instant,
)
pub fn set_timeout_weak<T: Tick>( &mut self, addr: WeakAddr<T>, deadline: Instant, )
Configure the timer to tick once at the specified time. The timer will not try to keep the actor alive.
Sourcepub fn set_timeout_strong<T: Tick>(&mut self, addr: Addr<T>, deadline: Instant)
pub fn set_timeout_strong<T: Tick>(&mut self, addr: Addr<T>, deadline: Instant)
Configure the timer to tick once at the specified time. The timer will try to keep the actor alive until that time.
Sourcepub fn set_timeout_for_weak<T: Tick>(
&mut self,
addr: WeakAddr<T>,
duration: Duration,
)
pub fn set_timeout_for_weak<T: Tick>( &mut self, addr: WeakAddr<T>, duration: Duration, )
Configure the timer to tick once after a delay. The timer will not try to keep the actor alive.
Sourcepub fn set_timeout_for_strong<T: Tick>(
&mut self,
addr: Addr<T>,
duration: Duration,
)
pub fn set_timeout_for_strong<T: Tick>( &mut self, addr: Addr<T>, duration: Duration, )
Configure the timer to tick once after a delay. The timer will try to keep the actor alive until that time.
Sourcepub fn run_with_timeout_weak<T: Tick + ?Sized, F: Future<Output = ()> + Send + 'static>(
&mut self,
addr: WeakAddr<T>,
deadline: Instant,
f: impl FnOnce(WeakAddr<T>) -> F + Send + 'static,
)
pub fn run_with_timeout_weak<T: Tick + ?Sized, F: Future<Output = ()> + Send + 'static>( &mut self, addr: WeakAddr<T>, deadline: Instant, f: impl FnOnce(WeakAddr<T>) -> F + Send + 'static, )
Configure the timer to tick once at the specified time, whilst simultaneously running a task to completion. If the timeout completes first, the task will be dropped. The timer will not try to keep the actor alive.
Sourcepub fn run_with_timeout_strong<T: Tick + ?Sized, F: Future<Output = ()> + Send + 'static>(
&mut self,
addr: Addr<T>,
deadline: Instant,
f: impl FnOnce(Addr<T>) -> F + Send + 'static,
)
pub fn run_with_timeout_strong<T: Tick + ?Sized, F: Future<Output = ()> + Send + 'static>( &mut self, addr: Addr<T>, deadline: Instant, f: impl FnOnce(Addr<T>) -> F + Send + 'static, )
Configure the timer to tick once at the specified time, whilst simultaneously running a task to completion. If the timeout completes first, the task will be dropped. The timer will try to keep the actor alive until that time.
Sourcepub fn run_with_timeout_for_weak<T: Tick + ?Sized, F: Future<Output = ()> + Send + 'static>(
&mut self,
addr: WeakAddr<T>,
duration: Duration,
f: impl FnOnce(WeakAddr<T>) -> F + Send + 'static,
)
pub fn run_with_timeout_for_weak<T: Tick + ?Sized, F: Future<Output = ()> + Send + 'static>( &mut self, addr: WeakAddr<T>, duration: Duration, f: impl FnOnce(WeakAddr<T>) -> F + Send + 'static, )
Configure the timer to tick once at the specified time, whilst simultaneously running a task to completion. If the timeout completes first, the task will be dropped. The timer will not try to keep the actor alive.
Sourcepub fn run_with_timeout_for_strong<T: Tick + ?Sized, F: Future<Output = ()> + Send + 'static>(
&mut self,
addr: Addr<T>,
duration: Duration,
f: impl FnOnce(Addr<T>) -> F + Send + 'static,
)
pub fn run_with_timeout_for_strong<T: Tick + ?Sized, F: Future<Output = ()> + Send + 'static>( &mut self, addr: Addr<T>, duration: Duration, f: impl FnOnce(Addr<T>) -> F + Send + 'static, )
Configure the timer to tick once at the specified time, whilst simultaneously running a task to completion. If the timeout completes first, the task will be dropped. The timer will try to keep the actor alive until that time.