[−][src]Struct iban::BaseIban
Represents an IBAN that passed basic checks, but not necessarily the BBAN validation. To be exact, the IBAN must be of the correct length, start with two uppercase ASCII letters, followed by two digits, followed by any number of digits and uppercase ASCII letters. Additionally its checksum should be valid. It should either contain no whitespace, or every block of four characters can be separated by a space.
Note that most useful methods are supplied by the trait IbanLike. The Display trait provides pretty
print formatting.
Examples
An example of parsing and using a correct IBAN:
use iban::{BaseIban, IbanLike}; let iban: BaseIban = "MR13 0002 0001 0100 0012 3456 753".parse()?; assert_eq!(iban.electronic_str(), "MR1300020001010000123456753"); // The pretty print format assert_eq!(iban.to_string(), "MR13 0002 0001 0100 0012 3456 753"); assert_eq!(iban.country_code(), "MR"); assert_eq!(iban.check_digits_str(), "13"); assert_eq!(iban.check_digits(), 13); assert_eq!(iban.bban_unchecked(), "00020001010000123456753");
An example of parsing invalid IBANs:
use iban::{BaseIban, ParseBaseIbanError}; assert_eq!( "MR$$".parse::<BaseIban>(), Err(ParseBaseIbanError::InvalidFormat) ); assert_eq!( "MR0000020001010000123456754".parse::<BaseIban>(), Err(ParseBaseIbanError::InvalidChecksum) );
Trait Implementations
impl Clone for BaseIban[src]
impl Copy for BaseIban[src]
impl Debug for BaseIban[src]
impl Display for BaseIban[src]
impl Eq for BaseIban[src]
impl From<Iban> for BaseIban[src]
impl FromStr for BaseIban[src]
type Err = ParseBaseIbanError
The associated error which can be returned from parsing.
fn from_str(address: &str) -> Result<Self, Self::Err>[src]
impl Hash for BaseIban[src]
fn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl IbanLike for BaseIban[src]
fn electronic_str(&self) -> &str[src]
fn country_code(&self) -> &str[src]
fn check_digits_str(&self) -> &str[src]
fn check_digits(&self) -> u8[src]
fn bban_unchecked(&self) -> &str[src]
impl PartialEq<BaseIban> for BaseIban[src]
impl StructuralEq for BaseIban[src]
impl StructuralPartialEq for BaseIban[src]
impl<'a> TryFrom<&'a str> for BaseIban[src]
type Error = ParseBaseIbanError
The type returned in the event of a conversion error.
fn try_from(value: &'a str) -> Result<Self, Self::Error>[src]
impl TryFrom<BaseIban> for Iban[src]
type Error = ParseIbanError
The type returned in the event of a conversion error.
fn try_from(base_iban: BaseIban) -> Result<Iban, ParseIbanError>[src]
Auto Trait Implementations
impl RefUnwindSafe for BaseIban
impl Send for BaseIban
impl Sync for BaseIban
impl Unpin for BaseIban
impl UnwindSafe for BaseIban
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,