1#[derive(Clone, Copy, Default, PartialEq)]
2pub enum Script {
3 #[default]
4 Latin,
5 Native,
6 Both,
7}
8
9#[derive(Clone, Copy, Default, PartialEq)]
10pub enum Ctx {
11 #[default]
12 None,
13 Loose,
14 Strict,
15}
16
17impl Ctx {
18 pub fn parse(s: &str) -> Self {
19 match s {
20 "strict" => Self::Strict,
21 "loose" => Self::Loose,
22 _ => Self::None,
23 }
24 }
25}
26
27#[derive(Clone, Copy, PartialEq)]
28pub enum Corrupt {
29 None,
30 Low,
31 Mid,
32 High,
33 Extreme,
34}
35
36impl Corrupt {
37 pub fn parse_level(s: &str) -> Option<Self> {
38 match s {
39 "low" => Some(Self::Low),
40 "mid" => Some(Self::Mid),
41 "high" => Some(Self::High),
42 "extreme" => Some(Self::Extreme),
43 _ => None,
44 }
45 }
46
47 pub fn rate(self) -> f64 {
48 match self {
49 Corrupt::None => 0.0,
50 Corrupt::Low => 0.05,
51 Corrupt::Mid => 0.15,
52 Corrupt::High => 0.45,
53 Corrupt::Extreme => 0.95,
54 }
55 }
56}