actix-derive

Derive macros for actix actors.

crates.io Documentation Minimum Supported Rust Version License Dependency Status

Usage

```rust use actix_derive::{Message, MessageResponse};

[derive(MessageResponse)]

struct Added(usize);

[derive(Message)]

[rtype(result = "Added")]

struct Sum(usize, usize);

fn main() {} ```

This code expands into following code:

```rust use actix::{Actor, Context, Handler, System}; use actix_derive::{Message, MessageResponse};

[derive(MessageResponse)]

struct Added(usize);

[derive(Message)]

[rtype(result = "Added")]

struct Sum(usize, usize);

[derive(Default)]

struct Adder;

impl Actor for Adder { type Context = Context; }

impl Handler for Adder { type Result = ::Result; fn handle(&mut self, msg: Sum, _: &mut Self::Context) -> Added { Added(msg.0 + msg.1) } }

fn main() {} ```

License

This project is licensed under either of

at your option.