Crate isin

source · []
Expand description

isin

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”).

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 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.
  2. 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.
  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 parse() or parse_loose() methods on the ISIN type to convert a string to a validated ISIN.

This crate is part of the Financial Identifiers series:

  • CUSIP: Committee on Uniform Security Identification Procedures (ANSI X9.6-2020)
  • ISIN: International Securities Identification Number (ISO 6166:2021)
  • LEI: Legal Entity Identifier (ISO 17442:2020)

Re-exports

pub use error::ISINError;

Modules

isin::checksum

isin::error

Structs

An ISIN in confirmed valid format.

Functions

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_strictDeprecated

Forwards to 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 Definitions

ParseErrorDeprecated

Type alias for backward compatibility. Do not use in new code.