children count
This commit is contained in:
parent
6d6141471f
commit
c3b04be872
1 changed files with 4 additions and 0 deletions
|
|
@ -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),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue