Struct cienli::ciphers::caesar::Caesar [−][src]
Caesar Cipher
The struct is generated through the new() function.
Implementations
impl Caesar
[src]
pub fn new(rotation: u8) -> Result<Caesar, &'static str>
[src]
Initialize a caesar cipher with a rotation.
Examples:
use cienli::ciphers::caesar::Caesar; let caesar = Caesar::new(5).unwrap();
Errors:
The rotation must be in range 1 and 26.
pub fn encipher(&self, message: &str) -> String
[src]
Enciphers a message with the caesar cipher.
Examples:
- Encipher with five times rotation:
use cienli::ciphers::caesar::Caesar; let caesar = Caesar::new(5).unwrap(); assert_eq!("Mjqqt, Ymnx Nx F Yjxy", caesar.encipher("Hello, This Is A Test"));
pub fn decipher(&self, message: &str) -> String
[src]
Deciphers a cipher with the caesar cipher.
Examples:
- Decipher with five times rotation:
use cienli::ciphers::caesar::Caesar; let caesar = Caesar::new(5).unwrap(); assert_eq!("Hello, This Is A Test", caesar.decipher("Mjqqt, Ymnx Nx F Yjxy"));
Auto Trait Implementations
impl RefUnwindSafe for Caesar
[src]
impl Send for Caesar
[src]
impl Sync for Caesar
[src]
impl Unpin for Caesar
[src]
impl UnwindSafe for Caesar
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,