Struct Bic
pub struct Bic(/* private fields */);Expand description
A validated SWIFT/BIC-style bank identifier code.
Implementations§
§impl Bic
impl Bic
pub fn new(value: impl AsRef<str>) -> Result<Bic, BicError>
pub fn new(value: impl AsRef<str>) -> Result<Bic, 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.
pub fn country_code(&self) -> &str
pub fn country_code(&self) -> &str
Returns the two-letter country code.
pub fn location_code(&self) -> &str
pub fn location_code(&self) -> &str
Returns the two-character location code.
pub fn branch_code(&self) -> Option<&str>
pub fn branch_code(&self) -> Option<&str>
Returns the optional three-character branch code.
pub fn is_primary_office(&self) -> bool
pub fn is_primary_office(&self) -> bool
Returns whether the BIC identifies a primary office.
Trait Implementations§
§impl Ord for Bic
impl Ord for Bic
§impl PartialOrd for Bic
impl PartialOrd for Bic
impl Eq 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