Use of children count and simple error handling

This commit is contained in:
Rendo 2025-11-08 20:57:55 +05:00
commit 5c99e80670
2 changed files with 30 additions and 4 deletions

View file

@ -12,10 +12,15 @@ pub struct Node {
}
impl Node {
pub fn new(children: Option<Vec<Node>>, handler: NodeHandler) -> Self {
pub fn new(
children: Option<Vec<Node>>,
handler: NodeHandler,
max_children_count: Option<usize>,
) -> Self {
Self {
children: children.unwrap_or(vec![]),
handler: handler,
max_children_count,
}
}
pub fn get_value(&self) -> f64 {