pub struct Alphabet<T: Copy + Hash + Eq> { /* private fields */ }
Expand description
Represents a set of characters that are valid in a crate::BlockId
.
An alphabet is generic over the type of data used to represent a “character”,
but Alphabet<char>
is used when generating string codes (otherwise, BlockId
will generate a Vec<T>
).
Several built-in alphabets are provided.
Examples:
let alpha1: Alphabet<char> = Alphabet::alphanumeric();
let hexchars: Vec<char> = "0123456789abcdef".chars().collect();
let alpha2: Alphabet<char> = Alphabet::new(&hexchars);
let alpha3: Alphabet<u32> = Alphabet::new(&[1234, 5678, 2345]);
Implementations§
source§impl Alphabet<char>
impl Alphabet<char>
sourcepub fn alphanumeric() -> Alphabet<char>
pub fn alphanumeric() -> Alphabet<char>
Returns an alphabet with lower- and upper-case letters, and numeral digits.
sourcepub fn lowercase_alphanumeric() -> Alphabet<char>
pub fn lowercase_alphanumeric() -> Alphabet<char>
Returns an alphabet with lower-case letters and numeral digits.
sourcepub fn lowercase_alpha() -> Alphabet<char>
pub fn lowercase_alpha() -> Alphabet<char>
Returns an alphabet with lowercase letters only.
Trait Implementations§
Auto Trait Implementations§
impl<T> RefUnwindSafe for Alphabet<T>where T: RefUnwindSafe,
impl<T> Send for Alphabet<T>where T: Send,
impl<T> Sync for Alphabet<T>where T: Sync,
impl<T> Unpin for Alphabet<T>where T: Unpin,
impl<T> UnwindSafe for Alphabet<T>where T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more