From e14eb1b87027cddd8ba002e932e9a870f19f87c4 Mon Sep 17 00:00:00 2001 From: Rendo Date: Thu, 6 Nov 2025 00:06:49 +0500 Subject: [PATCH] Small simple structure --- src/formula/mod.rs | 18 ++++++++++++++++++ src/formula/node/graph_constructor.rs | 1 + src/formula/node/mod.rs | 16 ++++++++++++++++ src/lib.rs | 1 + 4 files changed, 36 insertions(+) create mode 100644 src/formula/mod.rs create mode 100644 src/formula/node/graph_constructor.rs create mode 100644 src/formula/node/mod.rs create mode 100644 src/lib.rs diff --git a/src/formula/mod.rs b/src/formula/mod.rs new file mode 100644 index 0000000..b0d4024 --- /dev/null +++ b/src/formula/mod.rs @@ -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) -> Self { + match optional_root { + Some(root) => Formula { root }, + None => Formula { + root: node::Node::empty(), + }, + } + } +} diff --git a/src/formula/node/graph_constructor.rs b/src/formula/node/graph_constructor.rs new file mode 100644 index 0000000..94c0fff --- /dev/null +++ b/src/formula/node/graph_constructor.rs @@ -0,0 +1 @@ +pub struct GraphBuilder; diff --git a/src/formula/node/mod.rs b/src/formula/node/mod.rs new file mode 100644 index 0000000..90c22b9 --- /dev/null +++ b/src/formula/node/mod.rs @@ -0,0 +1,16 @@ +use crate::formula::node::graph_constructor::GraphBuilder; + +mod graph_constructor; + +pub struct Node { + children: Vec, +} + +impl Node { + pub fn empty() -> Self { + Node { children: vec![] } + } + pub fn build() -> GraphBuilder { + GraphBuilder + } +} diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..746f792 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1 @@ +mod formula;