Skip to main content

Module error

Module error 

Source
Expand description

customized library-wide error handling

§TheDijkstraError type

The DijkstraError enum is a centralized error type, every library component which may return an error uses DijkstraError

This type implements the Error trait manually, so to avoid introducing a dependency

use dijkstra_suite::error::DijkstraError;
use dijkstra_suite::compute::DistanceFromSource;

let mut distances = DistanceFromSource::default();

distances.set_distance((0, 0), 0, None);
let node_error = DijkstraError::ComputePathError("end node not found".into());

let result = distances.compute_path((0, 2));

assert_eq!(result, Err(node_error));

Enums§

DijkstraError
centralized error type