build | test | main |
---|---|---|
To reduce repeated implementations of a simple error enum, this crate
has been separated from the bforest
crates.
use btree_error::Error;
use btree_graph::BTreeGraph;
fn main() {
let mut graph: BTreeGraph<String, String> = BTreeGraph::new();
// Add nodes.
graph.add_vertex(String::from("Tarzan"));
graph.add_vertex(String::from("Jane"));
// Add a relationship.
let err: Error = graph.add_edge(String::from("Tarzan"), String::from("Sabor"), String::from("Hates")).unwrap_err();
// Assert error was returned.
assert_eq!(err, Error::VertexDoesNotExist);
}
It is doubtful anyone will use this crate by itself, but for completeness,
add the following to your Cargo.toml
file:
[dependencies]
btree_error = "0.1.0"
Please see the API for a the full definition.
This work is dually licensed under MIT OR Apache-2.0.