isin provides an
ISIN type for working with validated International Securities
Identification Numbers (ISINs) as defined in ISO 6166:2021 Financial services — International securities
identification number (ISIN) (“The Standard”).
An ISIN is comprised of 12 ASCII characters with the following parts, in order:
- A two-letter Prefix in uppercase, designating the issuer’s country
of registration or legal domicile, or for OTC derivatives the special code
EZ. Additional codes may be allocated by subsequent revisions to The Standard. Country codes follow the ISO 3166 standard.
- A nine-character uppercase alphanumeric Basic Code assigned by the corresponding National Numbering Agency, zero-padded on the left if the underlying code is shorter than nine characters.
- A single decimal digit representing the Check Digit computed using what the standard calls the “modulus 10 ‘double-add-double’ check digit”.
parse_loose() methods on the ISIN type to convert a string to a validated
This crate is part of the Financial Identifiers series:
An ISIN in confirmed valid format.
Build an ISIN from its parts: an Prefix and an Basic Code. The Check Digit is automatically computed.
Build an ISIN from a Payload (an already-concatenated Prefix and Basic Code). The _Check Digit is automatically computed.
Compute the check digit for an array of u8. No attempt is made to ensure the input string is in the ISIN payload format or length. If an illegal character (not an ASCII digit and not an ASCII uppercase letter) is encountered, this function will panic.
Parse a string to a valid ISIN or an error message, requiring the string to already be only uppercase alphanumerics with no leading or trailing whitespace in addition to being the right length and format.
Parse a string to a valid ISIN or an error, allowing the string to contain leading or trailing whitespace and/or lowercase letters as long as it is otherwise the right length and format.
parse() for backward compatibility. Do not use in new code.
Test whether or not the passed string is in valid ISIN format, without producing a ISIN struct value.
Type alias for backward compatibility. Do not use in new code.