pub struct Scheduler { /* private fields */ }
Expand description
The Scheduler
is a tool to schedule sending specific messages at a given
interval. It runs as its own thread.
Implementations§
Source§impl Scheduler
impl Scheduler
pub fn new() -> Self
Sourcepub fn schedule_message_subscription<M: Message + Clone, S: Service + Handler<M> + 'static>(
&mut self,
message: M,
mailbox: &Mailbox<S>,
period: &Duration,
)
pub fn schedule_message_subscription<M: Message + Clone, S: Service + Handler<M> + 'static>( &mut self, message: M, mailbox: &Mailbox<S>, period: &Duration, )
Schedule a new subscription. The message
will be sent to the mailbox
every period
.
The return value (if any) is ignored.
Sourcepub fn run(self, on_error: Box<dyn Fn(MailboxError) + Send>) -> JoinHandle<()>
pub fn run(self, on_error: Box<dyn Fn(MailboxError) + Send>) -> JoinHandle<()>
Run the Scheduler on its own thread
on_error
will be called when one of the messages cannot be delivered to the service.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Scheduler
impl !RefUnwindSafe for Scheduler
impl Send for Scheduler
impl !Sync for Scheduler
impl Unpin for Scheduler
impl !UnwindSafe for Scheduler
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