Crate isin[][src]

isin

isin provides an ISIN type for working with validated International Security Identifiers (ISINs) as defined in ISO 6166.

The Association of National Numbering Agencies (ANNA) has a page describing ISO 6166.

An ISIN is comprised of 12 ASCII characters with the following parts, in order:

  1. A two-letter ISO 3166 country code in upper-case, 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.
  2. A nine-character upper-case alphanumeric Security Identifier assigned by the corresponding National Numbering Agency, zero-padded on the left if the underlying code is shorter than nine characters.
  3. A single decimal digit representing the check digit computed using what the standard calls the “modulus 10 ‘double-add-double’ check digit”.

Use the ISIN::parse_loose() or ISIN::parse_strict() methods to convert a string to a validated ISIN.

Modules

checksum

isin::checksum

Structs

ISIN

Enums

ParseError

Functions

compute_check_digit

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_loose

Parse a string to a valid ISIN or an error message, 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_strict

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.