btree_error 0.1.0

To avoid duplication, all bforest libs use the same error defined in this crate.
Documentation

Binary Tree Error (btree_error)

CodeBuild Version badge Docs badge

To reduce repeated implementations of a simple error enum, this crate has been separated from the bforest crates.

Example

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);
}

Usage

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"

Implementation

Please see the API for a the full definition.

License

This work is dually licensed under MIT OR Apache-2.0.