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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

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

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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.

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.

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.