englishid

englishid forbids unsafe code crate version Live Build Status Documentation for <code>main</code> branch

English formatting for unsigned integers. Useful for encoding large IDs in a human-readable and recognizable format.

Basic Usage

Generating an ID can be done from any primitive unsigned integer type:

```rust use englishid::EnglishId;

let englishid = EnglishId::from(42u16).tostring().unwrap(); asserteq!(english_id, "acting-abacus"); ```

Use the corresponding parse method to extract the encoded id:

rust let parsed = englishid::parse_u16("acting-abacus").unwrap(); assert_eq!(parsed, 42);

Restricting word-length

The wordlist used can encode 51 bits of information in 4 words. If you'd prefer to restrict your u64 IDs to 51 bits, you can set the number of words used:

```rust use englishid::{EnglishId};

let englishid = EnglishId::from(123456789u64).words(4).tostring().unwrap(); asserteq!(english_id, "quantum-ashamed-abdominal-abacus"); ```

If a value is ever out of acceptable ranges, [Error::ValueOutOfRange] will be returned.