aranya-policy-ifgen

Crates.ioaranya-policy-ifgen
lib.rsaranya-policy-ifgen
version0.1.0
sourcesrc
created_at2024-10-16 20:49:15.518981
updated_at2024-10-16 20:49:15.518981
descriptionTools for generating Rust interfaces to Aranya Policies
homepage
repositoryhttps://github.com/aranya-project/aranya-core
max_upload_size
id1412346
size85,681
(aranya-project-bot)

documentation

README

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")
}
Commit count: 362

cargo fmt