pub struct Alphabet { /* private fields */ }
Implementations§
Source§impl Alphabet
impl Alphabet
pub fn cased(alphabet: &str) -> Result<Self>
pub fn caseless(alphabet: &str) -> Result<Self>
Sourcepub fn of_cased(text: &str) -> Self
pub fn of_cased(text: &str) -> Self
Generates an alphabet from a string of text. The created alphabet represents the unique characters of the given text in the order they appear.
This is equivalent to calling text.alphabet()
from the Analyze
trait.
§Parameters
text
- The text to get the alphabet of.
§Returns
The generated alphabet
§Performance
This is O(n)
for a given text of length n
.
pub fn from_ascii_range<R: RangeBounds<u8> + IntoIterator<Item = u8>>( range: R, ) -> Result<Self>
Sourcepub fn random_index_of_coincidence(&self) -> f64
pub fn random_index_of_coincidence(&self) -> f64
Returns the expected index of coincidence for a truly random string of characters of this alphabet with infinite length.
§Returns
The index of coincidence
pub fn characters(&self) -> &[char]
pub fn index_of(&self, character: char) -> Option<AlphabetIndex>
pub fn letter_at(&self, index: AlphabetIndex) -> &char
pub fn union(&self, other: &Self) -> Self
pub fn shift(&self, shift: u8) -> Self
Trait Implementations§
impl Eq for Alphabet
impl StructuralPartialEq for Alphabet
Auto Trait Implementations§
impl Freeze for Alphabet
impl RefUnwindSafe for Alphabet
impl Send for Alphabet
impl Sync for Alphabet
impl Unpin for Alphabet
impl UnwindSafe for Alphabet
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more