Function ractor::time::send_after

source ·
pub fn send_after<TMessage, F>(
    period: Duration,
    actor: ActorCell,
    msg: F
) -> JoinHandle<Result<(), MessagingErr<TMessage>>>
where TMessage: Message, F: FnOnce() -> TMessage + Send + 'static,
Expand description

Sends a message after a given period to the specified actor. The task terminates once the send has completed

  • period - The Duration representing the time to delay before sending
  • actor - The ActorCell representing the crate::Actor to communicate with
  • msg - The FnOnce message builder which is called to generate a message for the send operation

Returns: The [JoinHandle<Result<(), MessagingErr>>] which represents the backgrounded work. Awaiting the handle will yield the result of the send operation. Can be safely ignored to “fire and forget”