Skip to main content

Module actr_ref

Module actr_ref 

Source
Expand description

ActrRef - Lightweight reference to a running Actor

§Key Characteristics

  • Cloneable: Can be shared across tasks
  • Lightweight: Contains only an Arc to shared state
  • Auto-cleanup: Last ActrRef drop triggers resource cleanup

§Usage

let actr = Node::from_config_file("actr.toml")
    .await?
    .attach(&package)
    .await?
    .register(&ais_endpoint)
    .await?
    .start()
    .await?;

println!("actor id = {:?}", actr.actor_id());

// Wait for process signals and then perform a graceful shutdown.
actr.wait_for_ctrl_c_and_shutdown().await?;

The typestate chain is Node<Init> → Node<Attached> → Node<Registered> → ActrRef. Node::from_hyper is the escape hatch when you need to own HyperConfig construction yourself.

Structs§

ActrRef
ActrRef - Lightweight reference to a running Actor