#[non_exhaustive]pub enum ValidationError {
ColorLengthMismatch {
expected: usize,
actual: usize,
},
UnknownPiece,
UnknownColor,
SquareOutOfRange {
square: usize,
num_squares: usize,
},
InstanceOutOfRange {
instance: usize,
declared: usize,
},
}Expand description
Reasons a Problem can fail validate.
Returned by Problem::validate and
ProblemBuilder::try_build. Variants only carry the
problem-relative indices needed to locate the offending item; they
don’t carry P or C values so that the error type can be
Eq + Hash + Clone without dragging those bounds onto the user’s
piece / colour kinds.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ColorLengthMismatch
square_colors is non-empty but its length doesn’t match
num_squares. An empty square_colors is treated as
“no colour partition declared” and is not an error —
colour-keyed constraints will see zero matches.
UnknownPiece
A constraint references a piece kind that is not in the
problem’s alphabet (pieces).
UnknownColor
A CountOnColor constraint references a colour that doesn’t
appear in square_colors.
SquareOutOfRange
An At / NotAt constraint references a square index
>= num_squares.
InstanceOutOfRange
An Order or Relative constraint references a piece
instance index that exceeds the count declared for that piece
via Constraint::Count { Eq, n }. Only checked when the
piece has a declared Eq-count.
Trait Implementations§
Source§impl Clone for ValidationError
impl Clone for ValidationError
Source§fn clone(&self) -> ValidationError
fn clone(&self) -> ValidationError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ValidationError
impl Debug for ValidationError
Source§impl<'de> Deserialize<'de> for ValidationError
impl<'de> Deserialize<'de> for ValidationError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for ValidationError
impl Display for ValidationError
Source§impl Error for ValidationError
impl Error for ValidationError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl Hash for ValidationError
impl Hash for ValidationError
Source§impl PartialEq for ValidationError
impl PartialEq for ValidationError
Source§fn eq(&self, other: &ValidationError) -> bool
fn eq(&self, other: &ValidationError) -> bool
self and other values to be equal, and is used by ==.