rlifesrc_lib/error.rs
1//! All kinds of errors in this crate.
2
3use crate::cells::{Coord, State};
4use ca_rules::ParseRuleError;
5use displaydoc::Display;
6use thiserror::Error;
7
8/// All kinds of errors in this crate.
9#[derive(Clone, Debug, PartialEq, Eq, Display, Error)]
10pub enum Error {
11 /// Unable to set cell at {0:?}.
12 SetCellError(Coord),
13 /// Invalid rule: {0:?}.
14 ParseRuleError(#[from] ParseRuleError),
15 /// B0S8 rules are not supported yet. Please use the inverted rule.
16 B0S8Error,
17 /// Symmetry or transformation requires the world to be square.
18 SquareWorldError,
19 /// Symmetry or transformation requires the world to have no diagonal width.
20 DiagonalWidthError,
21 /// Width / height / period should be positive.
22 NonPositiveError,
23 /// Cell at {0:?} has invalid state: {1:?}.
24 InvalidState(Coord, State),
25}