[][src]Struct iban::Iban

pub struct Iban { /* fields omitted */ }

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");

Methods

impl Iban[src]

pub fn bban(&self) -> &str[src]

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");

pub fn bank_identifier(&self) -> Option<&str>[src]

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"));

pub fn branch_identifier(&self) -> Option<&str>[src]

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

impl Clone for Iban[src]

impl Copy for Iban[src]

impl Debug for Iban[src]

impl Display for Iban[src]

impl Eq for Iban[src]

impl From<Iban> for BaseIban[src]

impl FromStr for Iban[src]

type Err = ParseIbanError

The associated error which can be returned from parsing.

impl Hash for Iban[src]

impl IbanLike for Iban[src]

impl PartialEq<Iban> for Iban[src]

impl StructuralEq for Iban[src]

impl StructuralPartialEq for Iban[src]

impl<'a> TryFrom<&'a str> for Iban[src]

type Error = ParseIbanError

The type returned in the event of a conversion error.

fn try_from(value: &'a str) -> Result<Self, Self::Error>[src]

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.

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]

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.

Auto Trait Implementations

impl RefUnwindSafe for Iban

impl Send for Iban

impl Sync for Iban

impl Unpin for Iban

impl UnwindSafe for Iban

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.