| Crates.io | actix-signal |
| lib.rs | actix-signal |
| version | 0.3.0 |
| created_at | 2021-07-22 19:19:50.750736+00 |
| updated_at | 2024-02-05 04:15:12.446904+00 |
| description | Manage the lifecycle of an actix actor with its address. |
| homepage | |
| repository | https://github.com/PhotonQuantum/actix-signal |
| max_upload_size | |
| id | 426003 |
| size | 10,238 |
Manage the lifecycle of an actix actor with its address.
If you want to stop/terminate an actor, you call ActorContext::stop or ActorContext::terminate within its execution context.
However, sometimes you have access to its address only. This crate adds a bunch of methods to the address so that you may stop or terminate the actor outside its running context.
Minimum supported rust version: 1.50.0
Add the following line to your Cargo.toml.
actix-signal = { version = "0.1", features = ["derive"] }
use actix::{Actor, Context};
use actix_signal::SignalHandler;
#[derive(SignalHandler)]
struct MyActor;
impl Actor for MyActor {
type Context = Context<Self>;
}
let actor = MyActor;
let addr = actor.start();
addr.stop(); // Stop the actor
addr.terminate(); // Terminate the actor
derive - Provide #[derive(SignalHandler)] proc-macro.
MIT