1 unstable release

0.1.0 Jul 22, 2021

#15 in #terminate

Download history 96/week @ 2024-07-20 59/week @ 2024-07-27 79/week @ 2024-08-03 141/week @ 2024-08-10 12/week @ 2024-08-17 6/week @ 2024-08-24 41/week @ 2024-08-31 32/week @ 2024-09-07 24/week @ 2024-09-14 267/week @ 2024-09-21 305/week @ 2024-09-28 128/week @ 2024-10-05 117/week @ 2024-10-12 211/week @ 2024-10-19 51/week @ 2024-10-26 200/week @ 2024-11-02

603 downloads per month
Used in actix-signal

MIT license

3KB

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

Dependencies

~1.5MB
~36K SLoC