use behaviour_result::BehaviourResult;
use behaviour_node::BehaviourNode;
pub struct Node<F> {
pub name: &'static str,
callback: F
}
impl <F> Node<F> {
pub fn new(name: &'static str, callback: F) -> Node<F> {
Node {
name: name,
callback: callback
}
}
}
impl <T, F> BehaviourNode<T> for Node<F>
where F: FnMut(&mut T) -> BehaviourResult {
fn evaluate(&mut self, target: &mut T) -> BehaviourResult {
let args = (target,);
self.callback.call_mut(args)
}
}