Struct iban::Iban [−][src]
pub struct Iban { /* fields omitted */ }Expand description
Represents an IBAN. To obtain it, make use of the parse() function, which will make sure the
string follows the ISO 13616 standard. Apart from its own methods, Iban implements IbanLike,
which provides more functionality.
The impementation of Display provides spaced formatting of the IBAN. Electronic
formatting can be obtained via electronic_str.
A valid IBAN satisfies the defined format, has a valid checksum and has a BBAN format as defined in the IBAN registry.
Examples
use iban::*;
let address = "KZ86125KZT5004100100".parse::<iban::Iban>()?;
assert_eq!(address.to_string(), "KZ86 125K ZT50 0410 0100");Implementations
Get the BBAN part of the IBAN, as a &str. This method, in contrast to IbanLike::bban_unchecked,
is only available on the Iban structure, which means the returned BBAN string is always correct.
Example
use iban::*;
let iban: Iban = "DE44 5001 0517 5407 3249 31".parse()?;
assert_eq!(iban.bban(), "500105175407324931");Get the bank identifier of the IBAN. The bank identifier might not be
defined, in which case this method returns None.
Example
use iban::*;
let iban: Iban = "AD12 0001 2030 2003 5910 0100".parse()?;
assert_eq!(iban.bank_identifier(), Some("0001"));Get the branch identifier of the IBAN. The branch identifier might not be
defined, in which case this method returns None.
Example
use iban::*;
let iban: Iban = "AD12 0001 2030 2003 5910 0100".parse()?;
assert_eq!(iban.branch_identifier(), Some("2030"));Trait Implementations
Get the IBAN in the electronic format, without whitespace. This method is simply a view into the inner string. Read more
Get the country code of the IBAN. This method simply returns a slice of the inner representation. Read more
Get the check digits of the IBAN, as a string slice. This method simply returns
a slice of the inner representation. To obtain an integer instead,
use check_digits. Read more
Get the check digits of the IBAN. This method parses the digits to an
integer, performing slightly more work than check_digits_str. Read more
Get the BBAN part of the IBAN, as a &str. Note that the BBAN is not
necessarily valid if this is not guaranteed by the implementing type.
Use Iban::bban to guarantee a correct BBAN. Read more
Parse an IBAN without taking the BBAN into consideration.
Errors
If the string does not match the IBAN format or the checksum is
invalid, ParseIbanError::InvalidBaseIban will be
returned. If the country format is invalid or unknown, the other
variants will be returned with the BaseIban giving
access to some basic functionality nonetheless.
type Error = ParseIbanError
type Error = ParseIbanError
The type returned in the event of a conversion error.
Parse an IBAN without taking the BBAN into consideration.
Errors
If the string does not match the IBAN format or the checksum is
invalid, ParseIbanError::InvalidBaseIban will be
returned. If the country format is invalid or unknown, the other
variants will be returned with the BaseIban giving
access to some basic functionality nonetheless.
type Error = ParseIbanError
type Error = ParseIbanError
The type returned in the event of a conversion error.
Auto Trait Implementations
impl RefUnwindSafe for Iban
impl UnwindSafe for Iban
Blanket Implementations
Mutably borrows from an owned value. Read more
