Expand description
§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
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")
}Modules§
- macros
- Macros used in code generated by `policy_ifgen_build``.
Macros§
- format
- Creates a
Stringusing interpolation of runtime expressions. - ident
- Creates an
Identifierfrom a string literal. - text
- Creates a
Textfrom a string literal. - vm_
action - Creates a
VmAction. - vm_
effect - Creates a
VmEffectData.
Structs§
- Effect
Variant Mismatch - The effect did not match the expected variant.
- Identifier
- A textual identifier which matches
[a-zA-Z][a-zA-Z0-9_]*. - KVPair
- A generic key/value pair. Used for Effects and Command fields. Technically identical to a FactValue but separate to distinguish usage.
- Struct
- A Struct value
- Text
- A string-like value which is utf8 without nul bytes.
- VmAction
VmPolicy’s actions.- VmEffect
VmPolicy’s effects.
Enums§
- Client
Error - An error returned by the runtime client.
- Effects
Parse Error - Possible errors from policy effect parsing.
- Value
- All of the value types allowed in the VM
- Value
Conversion Error - Indicates that the Value conversion has failed
Traits§
- Actionable
- A type which can be used as a
VmAction. - TryFrom
Value - Trait for converting from a
Value, similar toTryFrom<Value>.