Countries

laravel-rust-iban Alpha Laravel for Rust

The IBAN country registry provides electronic lengths, BBAN structure, identifier ranges and SEPA and EU status.

The registry

The package supports the 89 prefixes in SWIFT IBAN Registry Release 103, dated September 2026. An unregistered prefix returns Error::UnknownCountry during parsing. French overseas departments use FR, the Åland Islands use FI, and Guernsey, Jersey and the Isle of Man use GB.

English country names use Unicode CLDR 49.0.0. SEPA status follows EPC409-09 v8.0, published in December 2025. EU status follows the EU member list.

Look up a country

country takes a two-letter code in either case and returns Option<&'static Country>. countries returns every record, in prefix order. A parsed Iban gives its own record with iban.country().

use laravel_rust_iban::country;

fn main() {
    let Some(belgium) = country("be") else { return };

    assert_eq!(belgium.code(), "BE");
    assert_eq!(belgium.name(), "Belgium");
    assert_eq!(belgium.iban_length(), 16);
    assert_eq!(belgium.bban_length(), 12);
    assert_eq!(belgium.bban_structure(), "3!n7!n2!n");
    assert_eq!(belgium.iban_structure(), "BE2!n3!n7!n2!n");
    assert_eq!(belgium.bank_id_range(), Some(0..=2));
    assert_eq!(belgium.national_check_digits_range(), Some(10..=11));
    assert!(belgium.is_sepa());
    assert!(belgium.is_eu_member());

    assert!(country("ZZ").is_none());
}

Fields

MethodReturns
code()The two-letter IBAN prefix
name()The English name
iban_length(), bban_length()The electronic lengths, as u8
iban_structure(), bban_structure()The structure in SWIFT notation, such as 3!n7!n2!n
iban_pattern(), bban_pattern()The structure as an anchored regular expression, for the regex crate
bank_id_range(), branch_id_range(), national_check_digits_range()Zero-based inclusive positions in the BBAN, or None
is_sepa()Whether the country takes part in the SEPA schemes
is_eu_member()Whether the country is an EU member state
swift_official()true for every supported country

The SWIFT notation uses n for digits, a for uppercase letters, c for uppercase letters and digits, and e for a space. Each field has a fixed length such as 3!n. The parser checks each BBAN byte against its field.