Struct graph_types::GraphError
source · pub struct GraphError { /* private fields */ }
Expand description
The error type of a graph operation, see GraphErrorKind
for more.
Size
The size of this struct is always 8 bytes.
use graph_theory::GraphError;
assert_eq!(std::mem::size_of::<GraphError>(), 8);
Examples
use graph_theory::GraphError;
GraphError::node_not_found(0); // node id 0 not found
GraphError::edge_out_of_range(0, 5); // edge id 0 out of range (max 5)
GraphError::custom("user angry"); // user is angry now
Implementations§
source§impl GraphError
impl GraphError
sourcepub fn custom<S>(message: S) -> Selfwhere
S: ToString,
pub fn custom<S>(message: S) -> Selfwhere S: ToString,
Some index is not found in storage.
Examples
- edge id 0 out of range
use graph_theory::{GraphError, Query};
GraphError::not_found(Query::edge(0));
GraphError::edge_not_found(0);
sourcepub fn not_found<Q: Into<Query>>(query: Q) -> Self
pub fn not_found<Q: Into<Query>>(query: Q) -> Self
Some index is not found in storage.
Examples
- edge id 0 out of range
use graph_theory::{GraphError, Query};
GraphError::not_found(Query::edge(0));
GraphError::edge_not_found(0);
sourcepub fn with_io_path<P>(self, path: P) -> Selfwhere
P: AsRef<Path>,
pub fn with_io_path<P>(self, path: P) -> Selfwhere P: AsRef<Path>,
Fill where the io error occurred.
Examples
- edge id 0 out of range
use graph_theory::{GraphError, Query};
GraphError::not_found(Query::edge(0));
GraphError::edge_not_found(0);
sourcepub fn node_out_of_range(index: usize, max: usize) -> Self
pub fn node_out_of_range(index: usize, max: usize) -> Self
Some index is not found in storage.
Examples
- edge id 0 out of range
use graph_theory::{GraphError, Query};
GraphError::not_found(Query::edge(0));
GraphError::edge_not_found(0);
sourcepub fn edge_out_of_range(index: usize, max: usize) -> Self
pub fn edge_out_of_range(index: usize, max: usize) -> Self
Some index is not found in storage.
Examples
- edge id 0 out of range
use graph_theory::{GraphError, Query};
GraphError::not_found(Query::edge(0));
Trait Implementations§
source§impl Debug for GraphError
impl Debug for GraphError
source§impl Display for GraphError
impl Display for GraphError
source§impl Error for GraphError
impl Error for GraphError
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
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()
Auto Trait Implementations§
impl !RefUnwindSafe for GraphError
impl Send for GraphError
impl Sync for GraphError
impl Unpin for GraphError
impl !UnwindSafe for GraphError
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