actix_derive 0.1.0

Actor framework for Rust
Documentation

actix-derive Build Status crates.io

Actix is a rust actor framework.


Actix is licensed under the Apache-2.0 license.

Features

  • actix-derive adds support for Rust Custom Derive / Macros 1.1 to actix

Usage

#[macro_use] extern crate actix_derive;

use std::io::Error;

#[derive(Message)]
#[rtype(usize, Error)]
struct Sum(usize, usize);

fn main() {}

This code exapnds into following code:

extern crate actix;
use std::io::Error;
use actix::ResponseType;

struct Sum(usize, Error);

impl ResponseType for Sum {
    type Item = usize;
    type Error = Error;
}

fn main() {}

Handler

Actix derive provide proc_macro attributes macro for nightly rust.

#![feature(proc_macro)]

extern crate actix;
extern crate actix_derive;
use actix_derive::*;

#[msg(usize)]
struct Sum {a: usize, b: usize}

struct SumActor;

#[actor(Context<_>)]
impl SumActor {

    #[simple(Sum)]
    fn sum(&mut self, a: usize, b: usize) -> usize {
        a + b
    }
}

fn main() {}

License

This project is licensed under either of

at your option.