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) -> GraphErrorwhere
S: ToString,
pub fn custom<S>(message: S) -> GraphErrorwhere
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>(query: Q) -> GraphError
pub fn not_found<Q>(query: Q) -> GraphError
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_support<Q>(query: Q) -> GraphError
pub fn not_support<Q>(query: Q) -> GraphError
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) -> GraphError
pub fn with_io_path<P>(self, path: P) -> GraphError
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) -> GraphError
pub fn node_out_of_range(index: usize, max: usize) -> GraphError
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) -> GraphError
pub fn edge_out_of_range(index: usize, max: usize) -> GraphError
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)>
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()
Auto Trait Implementations§
impl Freeze for GraphError
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