#[non_exhaustive]pub enum DijkstraError {
GenericZeroError(String),
DistanceEntryNotFound(String),
ComputePathError(String),
GraphNodeNotFound(String),
StrategyError(String),
}Expand description
centralized error type
§The DijkstraError error type
This enum is a centralized error type used throughout the library
It implements the Error trait manually so to avoid an external
dependency
§Example
Main function dijkstra_path()
as well as internals like DistanceFromSource::compute_path()
uses DijkstraError:
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));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
GenericZeroError(String)
error while generating the generic zero
DistanceEntryNotFound(String)
ComputePathError(String)
GraphNodeNotFound(String)
StrategyError(String)
Trait Implementations§
Source§impl Debug for DijkstraError
impl Debug for DijkstraError
Source§impl Display for DijkstraError
impl Display for DijkstraError
Source§impl Error for DijkstraError
impl Error for DijkstraError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl PartialEq for DijkstraError
impl PartialEq for DijkstraError
impl StructuralPartialEq for DijkstraError
Auto Trait Implementations§
impl Freeze for DijkstraError
impl RefUnwindSafe for DijkstraError
impl Send for DijkstraError
impl Sync for DijkstraError
impl Unpin for DijkstraError
impl UnsafeUnpin for DijkstraError
impl UnwindSafe for DijkstraError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more