1
0
This commit is contained in:
2024-09-10 14:21:23 +03:00
parent 336ea83612
commit bfbc8aa512
6 changed files with 459 additions and 16 deletions

View File

@@ -6,8 +6,8 @@ pub struct CaesarCipher {
}
impl CaesarCipher {
pub fn new(alphabet: impl Into<Vec<char>>, offset: i64) -> anyhow::Result<Self> {
let alphabet = alphabet.into();
pub fn new(alphabet: &str, offset: i64) -> anyhow::Result<Self> {
let alphabet = alphabet.chars().collect::<Vec<_>>();
let offset = offset % alphabet.len() as i64;
util::verify_alphabet(&alphabet)?;