Crate iban [] [src]

This crate provides an easy way to validate an IBAN (International Bank Account Number). To do so, you can use the function parse(). If you want to check whether the address has a valid BBAN (Basic Bank Account Number), you can use validate_bban(). It also contains some helper methods to make handling an IBAN easier.

Example

The following example does a full validation of the IBAN and BBAN format.

use iban::Iban;
use iban::BbanResult;

let account = "DE44500105175407324931".parse::<Iban>()?;

assert_eq!(account.validate_bban(), BbanResult::Valid);
assert_eq!(account.get_country_code(), "DE");
assert_eq!(account.get_check_digits(), 44);
assert_eq!(account.get_bban(), "500105175407324931");
assert_eq!(account.format_electronic(), "DE44500105175407324931");
assert_eq!(account.format_print(), "DE44 5001 0517 5407 3249 31");

Structs

Iban

Represents an IBAN. To obtain it, make use of the parse() function, which will make sure the string follows the ISO 13616 standard.

ParseIbanError

The result after using parse() or from_str() on an invalid IBAN. It indicates that the string does not follow the IBAN specification.

Enums

BbanResult

A variant of this enum is returned by the method validate_bban().