#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

#398 in Asynchronous

Download history 196/week @ 2024-10-16 13/week @ 2024-10-23 8/week @ 2024-10-30 17/week @ 2024-11-06 41/week @ 2024-11-13 112/week @ 2024-11-20 17/week @ 2024-11-27 213/week @ 2024-12-04 133/week @ 2024-12-11 308/week @ 2024-12-18 28/week @ 2024-12-25 307/week @ 2025-01-01 456/week @ 2025-01-08

1,100 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
~436K SLoC