Ector is an open source async, no-alloc actor framework for embedded devices

Related tags

Utilities ector
Overview

Ector is an open source async, no-alloc actor framework for embedded devices.

CI crates.io docs.rs Matrix

Ector is an open source async, no-alloc actor framework for embedded devices. It integrates with embassy, the embedded async project.

Actor System

An actor system is a framework that allows for isolating state within narrow contexts, making it easier to reason about system. Within a actor system, the primary component is an Actor, which represents the boundary of state usage. Each actor has exclusive access to its own state and only communicates with other actors through message-passing.

Example

#![macro_use]
#![feature(generic_associated_types)]
#![feature(type_alias_impl_trait)]

use ector::*;

/// A Counter that we wish to create an Actor for.
pub struct Counter {
    count: u32,
}

// The message our actor will handle.
pub struct Increment;

/// An Actor implements the Actor trait.
#[ector::actor]
impl Actor for Counter {
    /// The Message associated type is the message types that the Actor can receive.
    type Message<'m> = Increment;

    /// An actor has to implement the on_mount method. on_mount() is invoked when the internals of an actor is ready,
    /// and the actor can begin to receive messages from an inbox.
    ///
    /// The following arguments are provided:
    /// * The address to 'self'
    /// * An inbox from which the actor can receive messages
    async fn on_mount(&mut self, _: Address<Self::Message<'m>>, mut inbox: M)
        where M: Inbox<Self::Message<'m>> {
    {
        loop {
            // Await the next message and increment the counter
            let _ = inbox.next().await;
            self.count += 1;
        }
    }
}

 /// The entry point of the application is using the embassy runtime.
 #[embassy::main]
 async fn main(spawner: embassy::executor::Spawner) {

     // Mounting the Actor will spawn an embassy task
     let addr = ector::spawn_actor!(spawner, COUNTER, Counter, Counter { count  0 });

     // The actor address may be used in any embassy task to communicate with the actor.
     let _ = addr.notify(Increment).await;
 }

Building

To build ector, you must install the nightly rust toolchain. Once installed, you can build and test the framework by running

cargo test

Directory layout

  • ector - an actor framework
  • macros - macros used by drogue-device and application code

Contributing

See the document CONTRIBUTING.md.

Community

You might also like...
An open-source Windows client for Twitch.tv
An open-source Windows client for Twitch.tv

TwitchBox is a lightweight Windows client created to enhance the Twitch.tv experience. The app uses the Tauri framework, which includes a combination

Open-source Rewind.ai clone written in Rust and Vue running 100% locally with whisper.cpp

mind-overflow Open-source Rewind.AI clone built with Tauri and Vue. Leverages whisper.cpp for Speech-to-Text and (wip: llama.cpp for Text generation a

mach-dump can parse Mach-O core dumps taken with lldb from macOS and iOS devices.

mach-dump mach-dump can parse Mach-O core dumps taken with lldb from macOS and iOS devices. It has no external dependencies. Example use std::path::Pa

Incremental, multi-version remote backup tool for block devices.

bsync Incremental, multi-version remote backup tool for block devices. The on-disk backup format is a SQLite database and I've been dogfooding this on

Easily sync your clipboard between devices. This is a work in progress app.

Clipboard Sync Description Easily sync your clipboard between devices. This is a work in progress app. Stack Frontend: React Tauri isomorphic-ws TSX,

Crate of GitHub’s collection of gitignores, embedded, automatically updated

Gitignores GitHub’s collection of gitignores, embedded, automatically updated. API documentation. Public Domain via CC0-1.0 (same as source data). MSR

C API to SpringQL (for embedded mode)

SpringQL C Client This repository is a C client for SpringQL and provides it provides: springql.h: C header file. libspringql_client.{so,dylib}: Share

An asynchronous Hardware Abstraction Layer (HAL) for embedded systems

embedded-hal-async An asynchronous Hardware Abstraction Layer (HAL) for embedded systems. This crate contains asynchronous versions of the embedded-ha

A compatibility layer to smooth the transition between different versions of embedded-hal

Embedded HAL Compatibility Layer A compatibility layer to smooth the transition between different versions of embedded-hal (specifically 0.2.x and 1.0

Owner
Drogue IoT
Drogue IoT
Automatically cross-compiles the sysroot crates core, compiler_builtins, and alloc.

cargo-xbuild Cargo-xbuild is a wrapper for cargo build, which cross compiles the sysroot crates core, compiler_builtins, and alloc for custom targets.

Rust OSDev 241 Dec 30, 2022
no-std no-alloc Rust protobufs.

noproto No-std, no-alloc protocol buffers (protobuf) implementation in Rust, for embedded systems. Optimized for binary size and memory usage, not for

null 13 Jun 21, 2023
Port of the fantastic Iconoir Icon Pack to Rust embedded devices, with a focus on speed, usability, and completeness.

embedded-iconoir - Icons for every device, ever. What is embedded-iconor? embedded-iconoir is a library that allows you to use Iconoir on embedded dev

null 9 Mar 25, 2023
wasm actor system based on lunatic

Wactor WASM actor system based on lunatic. Actors run on isolated green threads. They cannot share memory, and communicate only through input and outp

Noah Corona 25 Nov 8, 2022
A partial actor pattern with a global orchestrator.

orchestra The orchestra pattern is a partial actor pattern, with a global orchestrator regarding relevant work items. proc-macro The proc macro provid

Parity Technologies 12 Dec 9, 2022
Freebsd-embedded-hal - Like linux-embedded-hal but FreeBSD

freebsd-embedded-hal Implementation of embedded-hal traits for FreeBSD devices: gpio: using libgpio, with stateful and toggleable support, with suppor

null 2 Oct 1, 2022
Another Async IO Framework based on io_uring

kbio, the Async IO Framework based on io_uring, is used in KuiBaDB to implement async io. Features Support multi-threading concurrent task submission.

KuiBaDB 59 Oct 31, 2022
Open Source terraform provider registry

Terustry Simple configurable proxy that implement terraform provider registry protocol, to build your own terraform provider private registry. How it

Open-Source by Veepee 53 Nov 24, 2022
Open-source NI maschine device handling

Open-source NI maschine device handling

william light 69 Dec 1, 2022
Free and open-source reimplementation of Native Mouse Lock (display_mouse_lock) in rust.

dml-rs display_mouse_lock in rust. Free, open-source reimplementation of display_mouse_lock (Native Mouse Lock) in Rust. Written because I felt like i

Tomat 4 Feb 12, 2023