pub struct Bic(/* private fields */);Expand description
A validated SWIFT/BIC-style bank identifier code.
Implementations§
Source§impl Bic
impl Bic
Sourcepub fn new(value: impl AsRef<str>) -> Result<Self, BicError>
pub fn new(value: impl AsRef<str>) -> Result<Self, BicError>
Creates a BIC after uppercase normalization and position-specific validation.
§Errors
Returns BicError::InvalidLength when the trimmed input is not 8 or 11 bytes,
BicError::InvalidBankCode when the first four characters are not letters,
BicError::InvalidCountryCode when the country code is not two letters,
BicError::InvalidLocationCode when the location code is not alphanumeric, and
BicError::InvalidBranchCode when the optional branch code is not alphanumeric.
Sourcepub fn country_code(&self) -> &str
pub fn country_code(&self) -> &str
Returns the two-letter country code.
Sourcepub fn location_code(&self) -> &str
pub fn location_code(&self) -> &str
Returns the two-character location code.
Sourcepub fn branch_code(&self) -> Option<&str>
pub fn branch_code(&self) -> Option<&str>
Returns the optional three-character branch code.
Sourcepub fn is_primary_office(&self) -> bool
pub fn is_primary_office(&self) -> bool
Returns whether the BIC identifies a primary office.
Trait Implementations§
impl Eq for Bic
Source§impl Ord for Bic
impl Ord for Bic
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Bic
impl PartialOrd for Bic
impl StructuralPartialEq for Bic
Auto Trait Implementations§
impl Freeze for Bic
impl RefUnwindSafe for Bic
impl Send for Bic
impl Sync for Bic
impl Unpin for Bic
impl UnsafeUnpin for Bic
impl UnwindSafe for Bic
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more