Expand description
§proqnt
A pronounceable quintuplet, or proquint, is a pronounceable 5-letter string encoding a unique 16-bit integer.
Proquints may be used to encode binary data such as IP addresses, public keys, and UUIDs in a more human-friendly way. For more information, check out the specification
§Basic Usage
use proqnt::{FromProquints, IntoProquints, Proquint};
assert_eq!(
format!("{}", Ipv4Addr::new(127, 0, 0, 1).proquint_encode()),
"lusab-babad"
);
assert!(
Ipv4Addr::new(127, 0, 0, 1).proquint_digits().eq([
u16::parse_proquints("lusab").unwrap(),
u16::parse_proquints("babad").unwrap()
].into_iter())
);
assert_eq!(
format!("{}", [127u8, 0, 0, 1].proquint_encode()),
"lusab-babad"
);
assert!(
Ipv4Addr::new(127, 0, 0, 1).proquint_encode().into_iter().eq([
"lusab".parse::<Proquint>().unwrap(),
"babad".parse::<Proquint>().unwrap()
].into_iter())
);
// NOTE: [127, 0, 0, 1] will yield an array of i32, which will give the wrong result!
Modules§
- fractional
- Encoding datatypes as fractional numbers of another datatype
Macros§
- fractional_
decode_ from_ big - Implement
FromFraction<S>
usingIntoFraction<T>
where multipleS
are required to make oneT
- fractional_
decode_ from_ small - Implement
FromFraction<S>
usingIntoFraction<T>
where oneS
produces multipleT
Structs§
- Parse
Proquint Digits - Parse a buffer as a series of dash-separated proquint digits
- Parse
Proquints - Parse a buffer as a series of dash-separated proquints
- Proquint
- A pronounceable quintuplet, or proquint
- Proquint
Encode - Encode data as proquints
- Proquint
Encode Iter - Iterate over some data’s proquint encoding
- Proquint
Parse Error - An error in parsing a proquint
Enums§
- Proquints
Parse Error - An error which occurs in parsing a stream of proquints
Constants§
- CONSONANT_
MASK - A 4-bit mask for the data contained in a proquint consonant
- FINAL_
CONSONANT_ MASK - The mask for the data contained in a proquint’s final consonant
- FINAL_
CONSONANT_ SHIFT - The shift for the data contained in a proquint’s final consonant
- FIRST_
CONSONANT_ MASK - The mask for the data contained in a proquint’s first consonant
- FIRST_
CONSONANT_ SHIFT - The shift for the data contained in a proquint’s first consonant
- FIRST_
SYLLABLE_ MASK - The mask for the data contained in a proquint’s first syllable
- FIRST_
SYLLABLE_ SHIFT - The shift for the data contained in a proquint’s first syllable
- FIRST_
VOWEL_ MASK - The mask for the data contained in a proquint’s first vowel
- FIRST_
VOWEL_ SHIFT - The shift for the data contained in a proquint’s first vowel
- PROQUINT_
CONSONANTS - The consonants which may appear in a proquint, indexed by their 4-bit binary values
- PROQUINT_
SYLLABLES - The syllables which may appear in a proquint, indexed by their 6-bit binary values
- PROQUINT_
VOWELS - The vowels which may appear in a proquint, indexed by their 2-bit binary values
- SECOND_
CONSONANT_ MASK - The mask for the data contained in a proquint’s second consonant
- SECOND_
CONSONANT_ SHIFT - The shift for the data contained in a proquint’s second consonant
- SECOND_
SYLLABLE_ MASK - The mask for the data contained in a proquint’s second syllable
- SECOND_
SYLLABLE_ SHIFT - The shift for the data contained in a proquint’s second syllable
- SECOND_
VOWEL_ MASK - The mask for the data contained in a proquint’s second vowel
- SECOND_
VOWEL_ SHIFT - The shift for the data contained in a proquint’s second vowel
- SYLLABLE_
MASK - A 6-bit mask for the data contained in a proquint syllable
- VOWEL_
MASK - A 2-bit mask for the data contained in a proquint vowel
Traits§
- From
Proquints - Data which can be constructed from a series of proquints
- Into
Proquints - Data which can be converted to a series of proquints