MyGit

actix/actix-derive

Fork: 38 Star: 38 (更新于 2024-12-22 04:45:22)

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-12-22 10:23:54 rustdesk/rustdesk

2024-12-22 08:48:41 lapce/lapce

2024-12-21 23:25:36 tw93/Pake

2024-12-19 19:31:32 dashpay/platform

2024-12-18 10:31:25 DioxusLabs/dioxus

2024-12-17 17:18:34 lanyeeee/jmcomic-downloader