pub trait AlphabetPackExt: Alphabet {
const PACK_BITS: usize;
const CHAR_TO_INDEX: [u8; 128];
// Provided method
fn char_to_index(ch: u8) -> Option<usize> { ... }
}Available on crate feature
packed only.Expand description
An extension trait for Alphabet that provides the pack size and reverse lookup.
This trait defines how many bits are needed to represent each character in the packed representation, and provides a reverse lookup map for O(1) character-to-index conversion.
Required Associated Constants§
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
Source§impl<A: Alphabet + AlphabetExt> AlphabetPackExt for A
Blanket implementation of AlphabetPackExt for all Alphabet types.
impl<A: Alphabet + AlphabetExt> AlphabetPackExt for A
Blanket implementation of AlphabetPackExt for all Alphabet types.
This automatically computes:
PACK_BITSfrom the alphabet size.CHAR_TO_INDEXfrom the symbol list.