Function ractor::time::send_interval

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

Sends a message to a given actor repeatedly after a specified time using the provided message generation function. The task will exit once the channel is closed (meaning the underlying crate::Actor has terminated)

  • period - The Duration representing the period for the send interval
  • actor - The ActorCell representing the crate::Actor to communicate with
  • msg - The Fn message builder which is called to generate a message for each send operation.

Returns: The JoinHandle which represents the backgrounded work (can be ignored to “fire and forget”)