4 releases (breaking)

0.4.0 Apr 2, 2024
0.3.0 Jan 18, 2024
0.2.0 Nov 27, 2023
0.1.0 Nov 24, 2023

#19 in #rpc-service

Download history 7/week @ 2024-01-18 16/week @ 2024-02-15 31/week @ 2024-02-22 3/week @ 2024-02-29 1/week @ 2024-03-07 2/week @ 2024-03-14 164/week @ 2024-03-28 33/week @ 2024-04-04

200 downloads per month
Used in aldrin

MIT/Apache

260KB
7K SLoC

Aldrin

Crates.io Crates.io Build status

Aldrin is a message bus for service-oriented RPC and general interprocess communication.

Aldrin busses are star-shaped: there is a cental component, called the broker, to which multiple clients can connect. These client can then publish services for other clients to use.

Services are described in a small DSL called Aldrin schema and are composed of functions and events. Schemata are then processed by a code generator, which can output both client and server-side code.

Here is a small toy example of an echo service:

service Echo {
    uuid = 8920965f-110a-42ec-915c-2a65a3c47d1f;
    version = 1;

    fn echo @ 1 {
        args = string;
        ok = string;

        err = enum {
            EmptyString @ 1;
        }
    }

    fn echo_all @ 2 {
        args = string;

        err = enum {
            EmptyString @ 1;
        }
    }

    event echoed_to_all @ 1 = string;
}

Crate organization

  • aldrin: This is the main crate, aimed at writing both client and server applications.
  • aldrin-broker: Implements the broker-side of the protocol.
  • aldrin-core: Shared protocol primitives used by aldrin and aldrin-broker.
  • aldrin-test: Utilities for setting up unit tests of Aldrin services.
  • aldrin-parser: Parser library for Aldrin schemata.
  • aldrin-codegen: Implements client and server code generation from Aldrin schemata.
  • aldrin-gen: Standalone frontend to the parser and code generation.
  • aldrin-macros: Contains a macro for code generation at compile-time.

lib.rs:

Aldrin code generation macros

This crate provides a single macro as an alternative frontend to the Aldrin code generator. It removes the need to generate code from a schema beforehand or as part of a build.rs.

See the documentation of the generate! macro for more information and usage examples.

Dependencies

~4.5MB
~79K SLoC