| Crates.io | arbutus |
| lib.rs | arbutus |
| version | 0.1.5 |
| created_at | 2024-10-12 08:28:31.675993+00 |
| updated_at | 2024-11-03 07:54:41.238575+00 |
| description | Arbutus Trees |
| homepage | https://github.com/boondocklabs/arbutus |
| repository | https://github.com/boondocklabs/arbutus |
| max_upload_size | |
| id | 1406323 |
| size | 112,535 |
Arbutus is a tree data structure library for Rust.
Arbutus provides a high-level API for constructing and manipulating trees, along with support for indexing and querying. The library focuses on simplicity, flexibility, and performance.
TreeBuilder API, which provides a composable way to construct tree structures.To get started with Arbutus, add the following dependency to your Cargo.toml file:
[dependencies]
arbutus = "0.1.0"
Example of building a tree
// Custom errors can be propagated through the builder closures
#[derive(Debug)]
enum MyError {
Fail(String),
}
#[derive(Debug)]
enum TestData {
Foo,
Bar,
String(String),
Baz,
}
let tree = TreeBuilder::<TestData, MyError>::new()
.root(TestData::Foo, |foo| {
debug!("Foo builder closure");
foo.child(TestData::Bar, |bar| {
debug!("Bar builder closure");
bar.child(TestData::Baz, |_| Ok(()))
})?;
foo.child(TestData::String("Hello".into()), |_| Ok(()))?;
Ok(())
})
.unwrap()
.done();
info!("{tree:#?}");
Arbutus is released under the MIT license. See the LICENSE file for details.