#[non_exhaustive]pub enum ArgumentErrorKind {
Show 15 variants
Missing,
Blank,
Empty,
Length {
actual: usize,
constraint: LengthConstraint,
metric: LengthMetric,
},
Comparison {
actual: ArgumentValue,
constraint: ComparisonConstraint,
},
Range {
actual: ArgumentValue,
constraint: RangeConstraint,
},
InvalidLengthConstraint {
constraint: LengthConstraint,
metric: LengthMetric,
},
InvalidRangeConstraint {
constraint: RangeConstraint,
},
NotANumber,
NotFinite {
actual: ArgumentValue,
},
Index {
index: usize,
size: usize,
role: IndexRole,
},
IndexRange {
start: usize,
end: usize,
size: usize,
},
Bounds {
offset: usize,
length: usize,
total_length: usize,
},
Pattern {
pattern: String,
expectation: PatternExpectation,
},
Custom {
code: String,
message: String,
},
}Expand description
Identifies the validation rule that an argument failed.
Each variant stores only structured context needed to inspect and format the failure. Validated string contents are never captured implicitly.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Missing
The required argument was absent.
Blank
The string argument contained no non-whitespace characters.
Empty
The collection argument was empty.
Length
The argument length did not satisfy a length constraint.
Fields
constraint: LengthConstraintThe required length relationship.
metric: LengthMetricThe unit used to measure the observed and required lengths.
Comparison
A scalar argument did not satisfy a comparison constraint.
Fields
actual: ArgumentValueThe observed numeric or duration value.
constraint: ComparisonConstraintThe required comparison relationship.
Range
The numeric argument was outside a required range.
Fields
actual: ArgumentValueThe observed numeric value.
constraint: RangeConstraintThe required range.
InvalidLengthConstraint
The supplied length constraint was internally invalid.
Fields
constraint: LengthConstraintThe invalid length constraint.
metric: LengthMetricThe unit to which the invalid constraint would have applied.
InvalidRangeConstraint
The supplied numeric range was internally invalid.
Fields
constraint: RangeConstraintThe invalid numeric range.
NotANumber
The argument or numeric constraint contained a floating-point NaN value.
NotFinite
The floating-point argument was positive or negative infinity.
Fields
actual: ArgumentValueThe rejected infinite floating-point value.
Index
An element or position index was outside its valid domain.
Fields
IndexRange
A position range was invalid for a collection size.
Fields
Bounds
An offset and length did not fit within a total length.
Fields
Pattern
A string did not satisfy a pattern expectation.
Fields
expectation: PatternExpectationWhether a match or non-match was required.
Custom
A caller-defined validation rule failed.
Trait Implementations§
Source§impl Clone for ArgumentErrorKind
impl Clone for ArgumentErrorKind
Source§fn clone(&self) -> ArgumentErrorKind
fn clone(&self) -> ArgumentErrorKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more