pub struct PasswordRulesError {
pub expectations: Vec<ExpectedAt>,
}
Expand description
Error that can result from parsing password rules
Fields§
§expectations: Vec<ExpectedAt>
Elements (like a character, string tag, or EoF) that the parser was expecting, along with the location where the element was expected
Implementations§
Source§impl PasswordRulesError
impl PasswordRulesError
Sourcepub fn to_string_pretty(&self, s: &str) -> Result<String, Error>
pub fn to_string_pretty(&self, s: &str) -> Result<String, Error>
Build a pretty version of the error given the original input string.
The default Display
implementation produces helpful output:
Error: expected one of:
"required", "allowed", "max-consecutive", "minlength", "maxlength", or EoF at 1:71
It doesn’t have access to the original input string, however, so it’s limited in what it can do.
This method produces pretty output with colors if you’re able to provide that:
error: parsing failed
--> 1:71
|
1 | minlength: 8; maxlength: 32; required: lower, upper; required: digit; allow
| ^ expected one of "required", "allowed", "max-consecutive", "minlength", "maxlength", or EoF
Trait Implementations§
Source§impl Clone for PasswordRulesError
impl Clone for PasswordRulesError
Source§fn clone(&self) -> PasswordRulesError
fn clone(&self) -> PasswordRulesError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for PasswordRulesError
impl Debug for PasswordRulesError
Source§impl Display for PasswordRulesError
impl Display for PasswordRulesError
Source§impl Error for PasswordRulesError
impl Error for PasswordRulesError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for PasswordRulesError
impl RefUnwindSafe for PasswordRulesError
impl Send for PasswordRulesError
impl Sync for PasswordRulesError
impl Unpin for PasswordRulesError
impl UnwindSafe for PasswordRulesError
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