#[non_exhaustive]pub enum Reason {
Kind,
Variant {
index: u32,
count: u32,
},
Fields {
expected: usize,
found: usize,
},
EmptyRange,
OutOfDomain,
Length {
expected: u32,
found: usize,
},
}Expand description
What is wrong with a pattern, in Error::InvalidPattern.
§Examples
use match_lang::Reason;
let reason = Reason::Fields { expected: 1, found: 2 };
assert_eq!(reason.to_string(), "expected 1 fields, found 2");Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Kind
The kind of pattern does not fit the type’s signature, such as an integer pattern on a sum type.
Variant
A variant index at or past the sum type’s variant count.
Fields
A variant or product pattern with the wrong number of fields.
Fields
EmptyRange
A range whose low end is above its high end.
OutOfDomain
An integer or range outside the bounds of an Int type.
Length
An array pattern that cannot have the array’s length: a fixed slice pattern of another length, or a rest pattern needing more elements.
Trait Implementations§
impl Copy for Reason
impl Eq for Reason
impl StructuralPartialEq for Reason
Auto Trait Implementations§
impl Freeze for Reason
impl RefUnwindSafe for Reason
impl Send for Reason
impl Sync for Reason
impl Unpin for Reason
impl UnsafeUnpin for Reason
impl UnwindSafe for Reason
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more