• Stars
    star
    122
  • Rank 292,031 (Top 6 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created over 4 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

act-zero

An actor system for Rust, designed with several goals in mind:

  • No boilerplate.
  • Ergonomic.
  • Supports standard trait-based static and dynamic polymorphism.
  • Embraces async/await.
  • Executor agnostic.

Very little code is required to get started:

use std::error::Error;

use futures::executor::LocalPool;
use act_zero::*;

struct SimpleGreeter {
    number_of_greets: i32,
}

impl Actor for SimpleGreeter {}

impl SimpleGreeter {
    async fn greet(&mut self, name: String) -> ActorResult<String> {
        self.number_of_greets += 1;
        Produces::ok(format!(
            "Hello, {}. You are number {}!",
            name, self.number_of_greets
        ))
    }
}

fn main() -> Result<(), Box<dyn Error>> {
    let mut pool = LocalPool::new();
    let spawner = pool.spawner();
    pool.run_until(async move {
        let actor_ref = Addr::new(
            &spawner,
            SimpleGreeter {
                number_of_greets: 0,
            },
        )?;

        let greeting = call!(actor_ref.greet("John".into())).await?;
        println!("{}", greeting);

        let greeting = call!(actor_ref.greet("Emma".into())).await?;
        println!("{}", greeting);
        Ok(())
    })
}

See the examples folder for more varied uses.

More Repositories

1

sqlxmq

Message queue implemented on top of PostgreSQL
Rust
137
star
2

ijson

More efficient alternative to `serde_json::Value` which saves memory by interning primitive values and using tagged pointers.
Rust
125
star
3

rnet

Rust
78
star
4

query_interface

Dynamically query a type-erased object for any trait implementation
Rust
65
star
5

lockless

Composable, lock-free, allocation-light data structures
Rust
59
star
6

aoc2018

Rust solutions to the Advent Of Code 2018
Rust
45
star
7

meteor-reactive-publish

Enable server-side reactivity for Meteor.publish
CoffeeScript
41
star
8

spanr

Procedural macro span debugger/visualizer
Rust
40
star
9

aerosol

Dependency injection for Rust
Rust
40
star
10

rust-field-offset

Safe pointer-to-member functionality for rust
Rust
33
star
11

posts

22
star
12

actix-interop

Allow access to actor contexts from within normal future combinators and async/await blocks
Rust
14
star
13

scoped-tls-hkt

A more flexible version of the Rust `scoped-tls` library
Rust
13
star
14

mockalloc

Rust library for testing code relying on the global allocator
Rust
13
star
15

raft-playground

Rust
10
star
16

meteor-server-deps

Enable server-side reactivity for meteor
CoffeeScript
10
star
17

raft-zero

Implementation of the Raft consensus algorithm on top of the act-zero actor framework
Rust
8
star
18

aoc2019

Solutions to the Advent of Code 2019 in Rust
Rust
7
star
19

minipre

Minimal C pre-processor in Rust
Rust
7
star
20

c_fixed_string-rs

Rust
5
star
21

OpenGL-D-Bindings

Up to date stand-alone opengl bindings for the D programming language
D
5
star
22

aoc2023

Rust
4
star
23

franz

Rust Kafka client library using Tokio
Rust
4
star
24

five_words

Rust
4
star
25

tenorite

Fast logic simulation Rust library
Rust
4
star
26

agentdb

Rust
3
star
27

bevy_clap

Bevy plugin to parse CLI arguments using clap
Rust
2
star
28

pure-raft

Rust
2
star
29

test

1
star
30

please

Rust
1
star
31

ruplace_viewer

Rust
1
star
32

diesel-setup-deps

Perform diesel setup for dependencies
Rust
1
star
33

topgui

Batchfile
1
star
34

deque_cell

Repository for crates.io `deque_cell` package
Rust
1
star
35

rust-workshop

Rust
1
star
36

rust-crud-example

Example rust CRUD app using Diesel ORM & Iron web framework
Rust
1
star