nodes 0.1.0

Library and cli of a simple node/though keeping system
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
pub struct Node<T> {
    pub children: Vec<Node<T>>,
    pub data: T,
}

impl<T> Node<T> {
    pub fn new(data: T) -> Node<T> {
        Node {
            children: Vec::new(),
            data
        }
    }

    pub fn add_child(&mut self, data: T) -> usize {
        self.children.push(Node::new(data));
        self.children.len() - 1
    }
}