Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
sheroz committed Aug 14, 2023
1 parent 8efd4ad commit 8ab3488
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
# A sample tree and parent-child relationship in Rust

## Tree structure

```rust

pub struct Tree {
pub root: Option<TreeNodeRef>,
}

pub struct TreeNode {
pub uuid: Uuid,
pub number: u32,
pub text: String,
pub parent: Option<TreeNodeRef>,
pub children: Option<Vec<TreeNodeRef>>,
}

pub type TreeNodeRef = Rc<RefCell<TreeNode>>;
```

## Sample methods

- new()
- add_child()
- count()
- search()
- remove()
- flatten()
- new
- add_child
- count
- search
- remove
- flatten

### Please look at tests in [src/tree.rs](src/tree.rs) for more details

0 comments on commit 8ab3488

Please sign in to comment.