pub struct Caesar { /* private fields */ }
Expand description
A Caesar cipher implementation.
Implementations§
Trait Implementations§
Source§impl Cipher for Caesar
impl Cipher for Caesar
Source§fn encipher(&self, ptext: &str) -> CipherResult
fn encipher(&self, ptext: &str) -> CipherResult
Enciphers the given plaintext (a str reference) using the Caesar cipher
and returns the ciphertext as a CipherResult
.
§Example
use ciphers::{Cipher, Caesar};
let caesar = Caesar::new(1);
let ctext = caesar.encipher("DEFENDTHEEASTWALLOFTHECASTLE");
assert_eq!(ctext.unwrap(), "EFGFOEUIFFBTUXBMMPGUIFDBTUMF");
Source§fn decipher(&self, ctext: &str) -> CipherResult
fn decipher(&self, ctext: &str) -> CipherResult
Deciphers the given ciphertext (a str reference) using the Caesar cipher
and returns the plaintext as a CipherResult
.
§Example
use ciphers::{Cipher, Caesar};
let caesar = Caesar::new(1);
let ptext = caesar.decipher("EFGFOEUIFFBTUXBMMPGUIFDBTUMF");
assert_eq!(ptext.unwrap(), "DEFENDTHEEASTWALLOFTHECASTLE");
Auto Trait Implementations§
impl Freeze for Caesar
impl RefUnwindSafe for Caesar
impl Send for Caesar
impl Sync for Caesar
impl Unpin for Caesar
impl UnwindSafe for Caesar
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