#[non_exhaustive]pub enum ValidationError {
Empty {
field: &'static str,
},
MissingField(&'static str),
TooLong {
field: &'static str,
observed: usize,
limit: usize,
},
BadChar {
field: &'static str,
byte: u8,
offset: usize,
},
Shape {
field: &'static str,
rule: &'static str,
},
Range {
field: &'static str,
min: i64,
max: i64,
got: i64,
},
}Expand description
Reasons a validated newtype constructor (e.g. crate::Address::new)
can reject its input.
Field names are stable; new variants are additive.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Empty
The candidate string was empty when a non-empty value was required.
MissingField(&'static str)
A required builder field was not set before crate::Parser::builder
finalisation. The string is the field name (e.g. "workspace_root").
TooLong
The candidate exceeds the per-field byte cap.
Fields
BadChar
A disallowed character appeared in the candidate.
Fields
Shape
The candidate failed a higher-level structural rule (balanced
quotes/brackets, expected digit count, etc.). rule is a short
machine-readable token (e.g. "unbalanced-brackets"); the message
embeds the input snippet for diagnostics.
Fields
Range
The candidate falls outside an allowed numeric range. Use for integer-shaped invariants — codec levels, percentages, port numbers.
Trait Implementations§
Source§impl Debug for ValidationError
impl Debug for ValidationError
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()