pub struct AccountNumber(/* private fields */);Expand description
A conservatively validated bank account number.
Implementations§
Source§impl AccountNumber
impl AccountNumber
Sourcepub fn new(value: impl AsRef<str>) -> Result<Self, BankAccountError>
pub fn new(value: impl AsRef<str>) -> Result<Self, BankAccountError>
Creates an account number from 1 to 34 ASCII alphanumeric characters.
§Errors
Returns BankAccountError::EmptyAccountNumber for empty input,
BankAccountError::AccountNumberTooLong for values longer than 34 characters, and
BankAccountError::InvalidAccountNumberCharacter for non-alphanumeric characters.
Sourcepub fn masked(&self) -> MaskedAccountNumber
pub fn masked(&self) -> MaskedAccountNumber
Returns a masked account number with the last four characters visible.
Trait Implementations§
Source§impl AsRef<str> for AccountNumber
impl AsRef<str> for AccountNumber
Source§impl Clone for AccountNumber
impl Clone for AccountNumber
Source§fn clone(&self) -> AccountNumber
fn clone(&self) -> AccountNumber
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 AccountNumber
impl Debug for AccountNumber
Source§impl Display for AccountNumber
impl Display for AccountNumber
Source§impl FromStr for AccountNumber
impl FromStr for AccountNumber
Source§impl Hash for AccountNumber
impl Hash for AccountNumber
Source§impl Ord for AccountNumber
impl Ord for AccountNumber
Source§fn cmp(&self, other: &AccountNumber) -> Ordering
fn cmp(&self, other: &AccountNumber) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for AccountNumber
impl PartialEq for AccountNumber
Source§impl PartialOrd for AccountNumber
impl PartialOrd for AccountNumber
impl Eq for AccountNumber
impl StructuralPartialEq for AccountNumber
Auto Trait Implementations§
impl Freeze for AccountNumber
impl RefUnwindSafe for AccountNumber
impl Send for AccountNumber
impl Sync for AccountNumber
impl Unpin for AccountNumber
impl UnsafeUnpin for AccountNumber
impl UnwindSafe for AccountNumber
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