#identifier #finance #entity #company #lei

lei

Support for creating and validating Legal Entity Identifiers (LEIs)

5 releases

0.2.4 Feb 10, 2023
0.2.3 Feb 9, 2023
0.2.2 Dec 22, 2022
0.2.1 May 29, 2022
0.1.0 Sep 13, 2021

#660 in Parser implementations

24 downloads per month

MIT/Apache

24KB
462 lines

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.1"

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.

Dependencies

~1MB
~15K SLoC