#actix-actor #actor #actix #lifecycle #terminate #signal

actix-signal

Manage the lifecycle of an actix actor with its address

3 releases (breaking)

0.3.0 Feb 5, 2024
0.2.0 Mar 18, 2022
0.1.1 Mar 18, 2022
0.1.0 Jul 22, 2021

#728 in Asynchronous

Download history 27/week @ 2024-06-02 176/week @ 2024-06-09 66/week @ 2024-06-16 116/week @ 2024-06-23 99/week @ 2024-06-30 51/week @ 2024-07-07 51/week @ 2024-07-14 103/week @ 2024-07-21 53/week @ 2024-07-28 76/week @ 2024-08-04 143/week @ 2024-08-11 8/week @ 2024-08-18 4/week @ 2024-08-25 41/week @ 2024-09-01 30/week @ 2024-09-08 31/week @ 2024-09-15

107 downloads per month

MIT license

10KB
55 lines

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

~4–13MB
~141K SLoC