1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
pub mod encrypt;
pub mod error;
pub mod prelude;

use crate::encrypt::*;
use std::sync::Arc;
use prelude::*;
use zero_pass_backend_derive::Method;
use std::str::FromStr;

#[derive(Method, Debug, Clone)]
pub enum Methods {
    Vigenere,
    Base64,
    Xor,
}

impl TryFrom<&str> for Methods {
    type Error = Error;

    fn try_from(value: &str) -> Result<Self> {
        Methods::try_from(value.to_string())
    }
}

impl FromStr for Methods {
    type Err = Error;

    fn from_str(value: &str) -> Result<Self> {
        Methods::try_from(value.to_string())
    }
}

#[cfg(test)]
mod tests;