This is a basic orchestration library written in Rust and still under development
state_function!
macroi.e.
rust
let fn1: fn(State<f32>) -> Result<State<f32>, Error> =
state_function!(pow2, f32);
A state is defined as follows
rust
pub struct State<T> {
pub proceed: bool,
pub outcome: Option<T>,
pub stage: Vec<bool>,
}
You can use the orchestration directly by using
rust
let result = vec![fn1, fn2, fn3]
.execute(State {
proceed: true,
outcome: Some(6.),
stage: Vec::<bool>::new(),
});
Or by using the registration trait and assigning string names to the orchestration functions. Which can be useful when you want to pass function sequences by configuration
``` rust registry.register(fn1, "pow2".tostring()); registry.register(fn2, "pow3".tostring()); registry.register(fn3, "sqrt".to_string());
let result = vec!["pow2", "pow3", "sqrt"]
.create(®istry.di_ref)
.execute(State {
proceed: true,
outcome: Some(6.),
stage: Vec::<bool>::new(),
});
```
Assigning values to the stage i.e.
rust
stage: vec![true, true, false, false],
allows you to bypass certain steps (marked as true, in the sequence)