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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// (c) 2017 Joost Yervante Damad
/// misc beer ingredient
#[derive(Serialize, Deserialize, Debug, Default)]
pub struct Misc {
/// name of the misc item
#[serde(skip)]
pub name: String,
/// version of the misc format (normally 1)
pub version: i64,
/// misc type
#[serde(rename="type")]
pub type_: MiscType,
/// misc type
#[serde(rename="use")]
pub use_: MiscUse,
/// time in minutes it is used
pub time: f64,
/// amount (liter or kg)
pub amount: f64,
/// if amount is in kg
pub amount_is_weight: bool,
/// short description what the ingredient is used for
pub use_for: Option<String>,
/// detailed notes
pub notes: Option<String>,
/// display string for time
pub display_time: Option<String>,
/// display string for amount
pub display_amount: Option<String>,
/// inventory
pub inventory: Option<String>,
}
/// misc type
#[derive(ToString, EnumString, Serialize, Deserialize, Debug)]
pub enum MiscType {
/// a spice
Spice,
/// a fining agent
Fining,
/// a water agent
#[serde(rename="Water Agent")]
#[strum(serialize="Water Agent")]
WaterAgent,
/// a herb
Herb,
/// a flavor
Flavor,
/// an other misc item
Other,
}
impl Default for MiscType {
fn default() -> MiscType {
MiscType::Spice
}
}
/// usage for a misc item
#[derive(ToString, EnumString, Serialize, Deserialize, Debug)]
pub enum MiscUse {
/// use in boil
Boil,
/// use in mash
Mash,
/// use in primary fermenter
Primary,
/// use in secondary fermenter
Secondary,
/// use at bottling
Bottling,
}
impl Default for MiscUse {
fn default() -> MiscUse {
MiscUse::Boil
}
}