1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//! All kinds of errors in this crate.

use crate::cells::{Coord, State};
use ca_rules::ParseRuleError;
use displaydoc::Display;
use thiserror::Error;

/// All kinds of errors in this crate.
#[derive(Clone, Debug, PartialEq, Eq, Display, Error)]
pub enum Error {
    /// Unable to set cell at {0:?}.
    SetCellError(Coord),
    /// Invalid rule: {0:?}.
    ParseRuleError(#[from] ParseRuleError),
    /// B0S8 rules are not supported yet. Please use the inverted rule.
    B0S8Error,
    /// Symmetry or transformation requires the world to be square.
    SquareWorldError,
    /// Symmetry or transformation requires the world to have no diagonal width.
    DiagonalWidthError,
    /// Width / height / period should be positive.
    NonPositiveError,
    /// Cell at {0:?} has invalid state: {1:?}.
    InvalidState(Coord, State),
}