children count

This commit is contained in:
Rendo 2025-11-08 20:50:22 +05:00
commit c3b04be872

View file

@ -8,6 +8,7 @@ mod node_modifier;
pub struct Node {
children: Vec<Node>,
handler: NodeHandler,
max_children_count: Option<usize>,
}
impl Node {
@ -35,18 +36,21 @@ impl Node {
Node {
children: vec![],
handler: NodeHandler::Number { number: n },
max_children_count: None,
}
}
pub fn function(func: fn(Vec<f64>) -> f64) -> Node {
Node {
children: vec![],
handler: NodeHandler::Function { function: func },
max_children_count: Some(1),
}
}
pub fn variable(getter: fn() -> f64) -> Node {
Node {
children: vec![],
handler: NodeHandler::Variable { getter },
max_children_count: Some(0),
}
}
}