pub struct Code { /* private fields */ }Expand description
A generated or parsed decimal one-time password.
Formatting always preserves leading zeroes to the configured width.
Implementations§
Source§impl Code
impl Code
Sourcepub fn parse(input: &str, digits: Digits) -> Result<Self, CodeError>
pub fn parse(input: &str, digits: Digits) -> Result<Self, CodeError>
Parses exactly the configured number of ASCII decimal digits.
Whitespace, signs, non-ASCII numerals, and missing leading zeroes are rejected rather than normalized.
§Errors
Returns CodeError::InvalidLength for a different byte length or
CodeError::NonDecimal for any non-ASCII-decimal byte.
Trait Implementations§
impl Copy for Code
impl Eq for Code
Auto Trait Implementations§
impl Freeze for Code
impl RefUnwindSafe for Code
impl Send for Code
impl Sync for Code
impl Unpin for Code
impl UnsafeUnpin for Code
impl UnwindSafe for Code
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