actix-signal

Crates.ioactix-signal
lib.rsactix-signal
version0.3.0
sourcesrc
created_at2021-07-22 19:19:50.750736
updated_at2024-02-05 04:15:12.446904
descriptionManage the lifecycle of an actix actor with its address.
homepage
repositoryhttps://github.com/PhotonQuantum/actix-signal
max_upload_size
id426003
size10,238
LightQuantum (PhotonQuantum)

documentation

README

actix-signal

crates.io Documentation

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.

actix-signal = { version = "0.1", features = ["derive"] }

Example

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

Feature flags

derive - Provide #[derive(SignalHandler)] proc-macro.

License

MIT

Commit count: 14

cargo fmt