conjure_oxide

Function get_rules

Source
pub fn get_rules() -> Vec<&'static Rule<'static>>
Expand description

Returns a copied Vec of all rules registered with the register_rule macro.

Rules are not guaranteed to be in any particular order.

ยงExample


#[register_rule]
fn identity(expr: &Expression, mdl: &Model) -> ApplicationResult {
  Ok(Reduction::pure(expr.clone()))
}

fn main() {
  println!("Rules: {:?}", get_rules());
}

This will print (if no other rules are registered):

  Rules: [Rule { name: "identity", application: MEM }]

Where MEM is the memory address of the identity function.