Skip to main content

Crate ordo_derive

Crate ordo_derive 

Source
Expand description

Procedural macros for Ordo rule engine

This crate provides derive macros for generating TypedContext implementations that enable zero-overhead field access in JIT-compiled code.

§Usage

use ordo_derive::TypedContext;

#[derive(TypedContext)]
#[repr(C)]  // Recommended for stable layout
pub struct LoanContext {
    pub amount: f64,
    pub credit_score: i32,
    pub approved: bool,
}

The macro generates an implementation of TypedContext that provides:

  • A static MessageSchema describing the struct layout
  • Direct field pointer access via field_ptr()
  • Nested field path resolution (for nested structs)

Derive Macros§

ProstTypedContext
Derive macro for generating TypedContext for prost-generated types
TypedContext
Derive macro for generating TypedContext implementations