Small simple structure
This commit is contained in:
parent
ae779dab4e
commit
e14eb1b870
4 changed files with 36 additions and 0 deletions
18
src/formula/mod.rs
Normal file
18
src/formula/mod.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
use crate::formula::node::Node;
|
||||||
|
|
||||||
|
pub mod node;
|
||||||
|
|
||||||
|
pub struct Formula {
|
||||||
|
root: node::Node,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Formula {
|
||||||
|
pub fn new(optional_root: Option<node::Node>) -> Self {
|
||||||
|
match optional_root {
|
||||||
|
Some(root) => Formula { root },
|
||||||
|
None => Formula {
|
||||||
|
root: node::Node::empty(),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1
src/formula/node/graph_constructor.rs
Normal file
1
src/formula/node/graph_constructor.rs
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
pub struct GraphBuilder;
|
||||||
16
src/formula/node/mod.rs
Normal file
16
src/formula/node/mod.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
use crate::formula::node::graph_constructor::GraphBuilder;
|
||||||
|
|
||||||
|
mod graph_constructor;
|
||||||
|
|
||||||
|
pub struct Node {
|
||||||
|
children: Vec<Node>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Node {
|
||||||
|
pub fn empty() -> Self {
|
||||||
|
Node { children: vec![] }
|
||||||
|
}
|
||||||
|
pub fn build() -> GraphBuilder {
|
||||||
|
GraphBuilder
|
||||||
|
}
|
||||||
|
}
|
||||||
1
src/lib.rs
Normal file
1
src/lib.rs
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
mod formula;
|
||||||
Loading…
Add table
Add a link
Reference in a new issue