aboutsummaryrefslogtreecommitdiff
path: root/mingling_core/src/asset/node.rs
diff options
context:
space:
mode:
Diffstat (limited to 'mingling_core/src/asset/node.rs')
-rw-r--r--mingling_core/src/asset/node.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/mingling_core/src/asset/node.rs b/mingling_core/src/asset/node.rs
index c8b7600..035d227 100644
--- a/mingling_core/src/asset/node.rs
+++ b/mingling_core/src/asset/node.rs
@@ -1,11 +1,16 @@
use just_fmt::kebab_case;
+/// Represents a command node, used to match user-input command paths.
+///
+/// The node consists of multiple parts, each separated by a dot (`.`), and automatically converted to kebab-case.
+/// For example, the input string `"node.subnode"` will be converted to a node representation of `["node", "subnode"]`.
#[derive(Debug, Default)]
pub struct Node {
node: Vec<String>,
}
impl Node {
+ /// Append a new part to the node path.
pub fn join(self, node: impl Into<String>) -> Node {
let mut new_node = self.node;
new_node.push(node.into());