https://github.com/veeso/orange-trees
🍊 A Rust implementation of the Tree data structure 🍊
https://github.com/veeso/orange-trees
data-structures rust rust-crate rust-library tree tree-structure
Last synced: 13 days ago
JSON representation
🍊 A Rust implementation of the Tree data structure 🍊
- Host: GitHub
- URL: https://github.com/veeso/orange-trees
- Owner: veeso
- License: mit
- Created: 2021-06-08T12:13:56.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-10-23T16:08:10.000Z (6 months ago)
- Last Synced: 2025-04-13T07:15:38.459Z (13 days ago)
- Topics: data-structures, rust, rust-crate, rust-library, tree, tree-structure
- Language: Rust
- Homepage:
- Size: 304 KB
- Stars: 7
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# orange-trees
![]()
~ A tree data structure implementation in Rust ~
Developed by @veeso
Current version: 0.1.3 (22/10/2024)
---
- [orange-trees](#orange-trees)
- [About orange-trees 🍊](#about-orange-trees-)
- [Get started 🏁](#get-started-)
- [Add orange-trees to your Cargo.toml 🦀](#add-orange-trees-to-your-cargotoml-)
- [Examples](#examples)
- [Contributing and issues 🤝🏻](#contributing-and-issues-)
- [Changelog ⏳](#changelog-)
- [License 📃](#license-)---
## About orange-trees 🍊
> Flowers in my hair, I belong by the sea
> Where we used to be, sitting by the orange trees
> ~ Orange Trees - Marina ~orange-trees is an implementation of the **Tree** data structure. It comes with a rich set of methods to manipulate and query nodes.
In orange-trees each Tree is represented by a *Node*, where each Node has a **Key**, which identify the node, a **Value** and a list of children, which are nodes too.
Key and value are defined by the user, since they are generics.```rust
#[macro_use]
extern crate orange_trees;use orange_trees::{Tree, Node};
// Create a tree using macro
let tree: Tree<&'static str, &'static str> = Tree::new(
node!("/", "/"
, node!("/bin", "bin/"
, node!("/bin/ls", "ls")
, node!("/bin/pwd", "pwd")
)
, node!("/tmp", "tmp/"
, node!("/tmp/dump.txt", "dump.txt")
, node!("/tmp/omar.txt", "omar.txt")
)
)
);// Create a tree using constructor
let tree: Tree<&'static str, &'static str> = Tree::new(
Node::new("/", "/")
.with_child(
Node::new("/bin", "bin/")
.with_child(Node::new("/bin/ls", "ls"))
.with_child(Node::new("/bin/pwd", "pwd"))
)
.with_child(
Node::new("/tmp", "tmp/")
.with_child(Node::new("/tmp/dump.txt", "dump.txt"))
.with_child(Node::new("/tmp/omar.txt", "omar.txt"))
.with_child(
Node::new("/tmp/.cache", "cache/")
.with_child(Node::new("/tmp/.cache/xyz.cache", "xyz.cache"))
)
),
);
```---
## Get started 🏁
### Add orange-trees to your Cargo.toml 🦀
```toml
orange-trees = "0.1.0"
```### Examples
Examples can be found in the homepage of the documentation at
---
## Contributing and issues 🤝🏻
Contributions, bug reports, new features and questions are welcome! 😉
If you have any question or concern, or you want to suggest a new feature, or you want just want to improve orange-trees, feel free to open an issue or a PR.Please follow [our contributing guidelines](CONTRIBUTING.md)
---
## Changelog ⏳
View orange-trees's changelog [HERE](CHANGELOG.md)
---
## License 📃
orange-trees is licensed under the MIT license.
You can read the entire license [HERE](LICENSE)