1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
mod edge_type;
mod node;
mod pattern;

pub use edge_type::*;
pub use node::*;
pub use pattern::*;

use thiserror::Error;

#[derive(Debug, Error, Eq, PartialEq)]
/// Errors that can occur when working with a [Pattern]
pub enum PatternError {
    #[error("Node index {0} exceeds the number of nodes in the pattern")]
    /// An error that occurs when a node index exceeds the number of nodes in the [Pattern]
    NodeIndexOutOfBounds(usize),

    #[error("The pattern contains a cycle")]
    /// An error that occurs when the [Pattern] contains a cycle
    ContainsCycle,
}

/// A result type for operations on a [Pattern]
pub type Result<T> = std::result::Result<T, PatternError>;