#aranya #policy #generate #policies #generator #interface #typed

aranya-policy-ifgen

Tools for generating Rust interfaces to Aranya Policies

3 releases (breaking)

0.3.1 Dec 19, 2024
0.3.0 Dec 19, 2024
0.2.0 Dec 4, 2024
0.1.0 Oct 16, 2024

#438 in Asynchronous

Download history 193/week @ 2024-10-15 16/week @ 2024-10-22 4/week @ 2024-10-29 18/week @ 2024-11-05 23/week @ 2024-11-12 128/week @ 2024-11-19 22/week @ 2024-11-26 173/week @ 2024-12-03 172/week @ 2024-12-10 309/week @ 2024-12-17 10/week @ 2024-12-24 115/week @ 2024-12-31

625 downloads per month
Used in 2 crates (via aranya-daemon)

AGPL-3.0-only

440KB
10K SLoC

Policy Interface Generation

Generate typed Rust interface from policy code.

Quickstart

# Cargo.toml

[dependencies]
aranya-policy-ifgen = { ... }

[build-dependencies]
aranya-policy-ifgen-build = { ... }
// build.rs

fn main() {
    println!("cargo:rerun-if-changed=src/policy.md");
    aranya_policy_ifgen_build::generate("src/policy.md", "src/policy.rs").unwrap();
}
// src/lib.rs

#[rustfmt::skip]
mod policy;

impl aranya_policy_ifgen::Actor for MyActor { ... }

fn do_the_thing(actor: &MyActor) -> Result<(), aranya_runtime::ClientError> {
    use policy::ActorExt;
    actor.some_action(42, "my string")
}

Dependencies

~18–28MB
~430K SLoC