2021-04-18 16:40:41 -05:00
|
|
|
use rand::Rng;
|
2021-04-13 18:01:19 -05:00
|
|
|
|
2021-04-18 16:40:41 -05:00
|
|
|
#[derive(Debug, Clone, PartialEq)]
|
|
|
|
pub enum Abool {
|
|
|
|
Never = -1,
|
|
|
|
Sometimes = 0,
|
|
|
|
Always = 1,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Into<bool> for Abool {
|
|
|
|
fn into(self) -> bool {
|
|
|
|
match self {
|
|
|
|
Abool::Never => false,
|
|
|
|
Abool::Always => true,
|
|
|
|
Abool::Sometimes => rand::thread_rng().gen(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-18 09:39:43 -05:00
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
pub enum Value {
|
2021-04-13 18:01:19 -05:00
|
|
|
Str(String),
|
|
|
|
Int(i32),
|
|
|
|
Bool(bool),
|
2021-04-18 16:40:41 -05:00
|
|
|
Abool(Abool),
|
2021-04-13 18:01:19 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct Variable {
|
|
|
|
melo: bool,
|
|
|
|
value: Value,
|
2021-04-27 04:57:11 -05:00
|
|
|
}
|