MyGit

actix/actix-derive

Fork: 38 Star: 39 (更新于 2024-11-02 05:51:28)

license: Apache-2.0

Language: Rust .

[ARCHIVED] development moved into main actix repo

最后发布版本: 0.5.0 ( 2019-10-27 14:04:01)

官方网址 GitHub网址

actix-derive Build Status crates.io

Actix is a rust actor framework.


Features

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

Usage

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:

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<Self>;
}

impl Handler<Sum> for Adder {
    type Result = <Sum as actix::Message>::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.

最近版本更新:(数据更新于 2024-10-02 10:11:55)

2019-10-27 14:04:01 0.5.0

2018-11-04 19:08:53 0.3.2

2018-10-29 02:01:36 0.3.1

2018-07-21 07:26:23 v0.3.0

2018-02-18 04:31:13 v0.2.0

2017-12-24 10:27:31 v0.1.1

2017-12-24 09:15:52 v0.1.0

主题(topics):

actix, rust, rust-library

actix/actix-derive同语言 Rust最近更新仓库

2024-11-05 08:48:52 lapce/lapce

2024-11-04 19:47:57 dashpay/platform

2024-11-01 02:26:55 mediar-ai/screenpipe

2024-10-30 06:09:45 electric-capital/crypto-ecosystems

2024-10-29 10:21:58 rustdesk/rustdesk

2024-10-27 15:42:03 jtroo/kanata