iso17442-types 0.3.3

ISO 17442 Types
Documentation

ISO 17442 Types

Crates.ioDocs.rsMSRV 1.87.0

This crate provides no-std, no-alloc compatible data structures for use handling ISO 17442 Legal Entity IDs. The primary type is Lei, which is an owned (but non-heap) representation of an LEI string. For example:

use iso17442_types::Lei;
use core::str::FromStr;

const LEI_STR: &str = "YZ83GD8L7GG84979J516";

let l = Lei::from_str(LEI_STR).expect("Could not parse LEI");
let s = l.as_str();

assert_eq!(s, LEI_STR);

There is also an additional lei borrow type. This is the &str to Lei's String:

use iso17442_types::{Lei, lei};
use core::str::FromStr;

const LEI_STR: &str = "YZ83GD8L7GG84979J516";

let l = lei::from_str_slice(LEI_STR).expect("Could not parse LEI");

assert_eq!(l.as_str(), LEI_STR);

Both of these types are fully usable in the const context, making them suitable for use within static data.