https://github.com/LightQuantumArchive/actix-signal
Manage the lifecycle of an actix actor with its address.
https://github.com/LightQuantumArchive/actix-signal
actix actor lifecycle signal stop terminate
Last synced: 3 months ago
JSON representation
Manage the lifecycle of an actix actor with its address.
- Host: GitHub
- URL: https://github.com/LightQuantumArchive/actix-signal
- Owner: LightQuantumArchive
- License: mit
- Created: 2021-07-22T00:49:01.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-03-04T21:34:07.000Z (over 1 year ago)
- Last Synced: 2025-03-14T20:53:31.953Z (3 months ago)
- Topics: actix, actor, lifecycle, signal, stop, terminate
- Language: Rust
- Homepage:
- Size: 51.8 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# actix-signal
[](https://crates.io/crates/actix-signal)
[](https://docs.rs/actix-signal)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*
## Get Started
Add the following line to your `Cargo.toml`.
```toml
actix-signal = { version = "0.1", features = ["derive"] }
```## Example
```rust
use actix::{Actor, Context};
use actix_signal::SignalHandler;#[derive(SignalHandler)]
struct MyActor;impl Actor for MyActor {
type Context = Context;
}let actor = MyActor;
let addr = actor.start();addr.stop(); // Stop the actor
addr.terminate(); // Terminate the actor
```# Feature flags
`derive` - Provide `#[derive(SignalHandler)]` proc-macro.
# License
MIT