Crates.io | btree_error |
lib.rs | btree_error |
version | 0.1.0 |
source | src |
created_at | 2021-01-29 21:27:46.61864 |
updated_at | 2021-01-29 21:27:46.61864 |
description | To avoid duplication, all bforest libs use the same error defined in this crate. |
homepage | https://github.com/jameone/btree_error |
repository | https://github.com/jameone/btree_error |
max_upload_size | |
id | 348243 |
size | 20,209 |
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.