Macro bhv::seq

source ·
macro_rules! seq {
    () => { ... };
    ($($x:expr),+$(,)?) => { ... };
}
Expand description

A macro used to create a sequence from a list of behaviors. Sequences run every behavior until one of them fails.

Example

use bhv::*;

let tree = seq! {
    cond(|v| *v > 10), // only run if v > 10
    action(|_v| println!("v is greater than 10")),
};

assert!(tree.execute(&mut 11) == true);
// assert!(tree.execute(&mut 9) == false);