Crates.io | aranya-policy-ifgen |
lib.rs | aranya-policy-ifgen |
version | 0.1.0 |
source | src |
created_at | 2024-10-16 20:49:15.518981 |
updated_at | 2024-10-16 20:49:15.518981 |
description | Tools for generating Rust interfaces to Aranya Policies |
homepage | |
repository | https://github.com/aranya-project/aranya-core |
max_upload_size | |
id | 1412346 |
size | 85,681 |
Generate typed Rust interface from policy code.
# 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")
}