Crate alphabetic

Crate alphabetic 

Source
Expand description

§Alphabetic

“Alphabetic” is simple crate featuring AlphabeticLetter struct, that represents a letter in Latin-script alphabet.

Provides AlphabeticLetter::shift() method that shifts forward or backward in alphabet. Wraps around when reaching the end.

§Examples

let mut letter = AlphabeticLetter::try_from('A')?;
letter.shift(5);
assert_eq!(char::from(letter),'F');

Changing first letter of a string:

let mut vector = AlphabeticLetter::try_from_string("Rust").unwrap();
vector.first_mut().unwrap().shift(-5);
let new_string = vector.into_iter().map(char::from).collect::<String>();
assert_eq!(new_string, "Must");

Structs§

AlphabeticLetter
A type representing a letter of Latin-script alphabet.
NotAlphabeticError
The generic error type for conversion.

Enums§

LetterCase
A type representing a letter case.

Type Aliases§

Result
Result of a value conversion process.