lei

Crates.iolei
lib.rslei
version0.2.5
sourcesrc
created_at2021-09-13 13:04:29.06747
updated_at2023-06-08 19:46:51.961906
descriptionSupport for creating and validating Legal Entity Identifiers (LEIs)
homepage
repositoryhttps://github.com/gnp/lei-rs.git
max_upload_size
id450543
size61,318
Gregor Purdy (gnp)

documentation

README

lei

An LEI type for working with validated Committee on Legal Entity Identifiers (LEIs) as defined in ISO 17442:2020 "Financial services — Legal entity identifier (LEI) — Part 1: Assignment".

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)

Usage

Add this to your Cargo.toml:

[dependencies]
lei = "0.2"

Example

use lei;
let lei_string = "YZ83GD8L7GG84979J516"; // Example from Section A.1 of The Standard
match lei::parse(lei_string) {
    Ok(lei) => {
        println!("Parsed LEI: {}", lei.to_string()); // "YZ83GD8L7GG84979J516"
        println!("  LOU ID: {}", lei.lou_id()); // "YZ83"
        println!("  Entity ID: {}", lei.entity_id()); // "GD8L7GG84979J5"
        println!("  Check digits: {}", lei.check_digits()); // "16"
    }
    Err(err) => panic!("Unable to parse LEI {}: {}", lei_string, err),
}

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Commit count: 20

cargo fmt