Skip to main content

send_interval

Function send_interval 

Source
pub fn send_interval<A, M>(
    period: Duration,
    ctx: Context<A>,
    msg: M,
) -> TimerHandle
where A: Actor + Handler<M>, M: Message + Clone,
Expand description

Send a message to an actor repeatedly at a fixed interval.

The message type must implement Clone since a copy is sent on each tick. For #[protocol]-generated messages, unit structs (no fields) derive Clone automatically. For structs with fields, implement Clone manually on the generated message struct (e.g., impl Clone for my_protocol::MyMessage { .. }).