This crate provides an easy way to validate an IBAN (International Bank Account Number). To do
so, you can use the function parse(). This will check the IBAN rules
as well as the BBAN structure. The provided Iban structure provides many methods
to easy the handling of an IBAN. Many of these methods are provided via the IbanLike
trait.
When BBAN parsing fails, the error type ParseIbanError provides useful
information about what went wrong. Additionally, the error contains BaseIban,
which can still be used to access useful information.
Example
The following example does a full validation of the IBAN and BBAN format.
use *;
let account = "DE44500105175407324931".?;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
# Ok::
What does this library provide?
- A
Ibantype that can be used to parse account numbers very quickly. It doesn't require allocations at all, and instead leveragesarrayvecunder the hood. - A flexible API that is useful even when the country is not in the Swift
registry (using
BaseIban). Instead of using panic, the crate provides typed errors with what went wrong. - All functionality can be used in a
no_stdenvironment (except for the implementation ofstdtraits). - Optional serialization and deserialization via
serde. - CI tested results via the Swift provided and custom test cases, as well as proptest.
#![forbid(unsafe_code)], making sure all code is written in safe Rust.
Usage
The crate can be found on crates.io. To use this crate, just add it as an dependency:
[]
= "4"
Features
The following features can be used to configure the crate: