#tree-node #node-tree #tree-data-structures #node-key #tree #key-value

orange-trees

Tree data structure with several methods to query and manipulate nodes

4 releases

0.1.3 Oct 23, 2024
0.1.2 Oct 22, 2024
0.1.1 Oct 22, 2024
0.1.0 Jun 9, 2021

#372 in Data structures

Download history 188/week @ 2024-12-01 183/week @ 2024-12-08 180/week @ 2024-12-15 97/week @ 2024-12-22 54/week @ 2024-12-29 263/week @ 2025-01-05 193/week @ 2025-01-12 114/week @ 2025-01-19 94/week @ 2025-01-26 117/week @ 2025-02-02 124/week @ 2025-02-09 151/week @ 2025-02-16 192/week @ 2025-02-23 177/week @ 2025-03-02 127/week @ 2025-03-09 76/week @ 2025-03-16

622 downloads per month
Used in 7 crates (3 directly)

MIT license

38KB
570 lines

orange-trees

logo

~ A tree data structure implementation in Rust ~

Developed by @veeso

Current version: 0.1.3 (22/10/2024)

License-MIT Repo stars Downloads counter Latest version Ko-fi

CI Coveralls Docs



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.

#[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 🦀

orange-trees = "0.1.0"

Examples

Examples can be found in the homepage of the documentation at https://docs.rs/orange-trees


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


Changelog ⏳

View orange-trees's changelog HERE


License 📃

orange-trees is licensed under the MIT license.

You can read the entire license HERE

No runtime deps