recipes/db/src/data.rs

63 lines
1.3 KiB
Rust

#[derive(Debug)]
pub struct Ingredient {
pub key: &'static str,
translates: IngredientTranslate,
}
#[derive(Debug)]
pub struct IngredientTranslate {
ru: &'static str,
en: Option<&'static str>,
}
#[derive(Debug)]
pub struct Recipe {
key: &'static str,
ingredients: Vec<RecipeIngredient>,
steps: u8,
translates: RecipeTranslates,
}
#[derive(Debug)]
pub struct RecipeIngredient {
key: &'static str,
measure: RecipeIngredientMeasure,
}
#[derive(Debug)]
pub enum RecipeIngredientMeasure {
Gram(u32),
KiloGram(u32),
MilliLiter(u32),
Liter(u32),
}
#[derive(Debug)]
pub struct RecipeTranslates {
ru: RecipeTranslate,
en: Option<RecipeTranslate>,
}
#[derive(Debug)]
pub struct RecipeTranslate {
name: &'static str,
instructions: Vec<&'static str>,
}
pub const INGREDIENTS: [Ingredient; 3] = [
Ingredient {
key: "apple",
translates: IngredientTranslate {
ru: "яблоко",
en: Some("apple"),
}
},
Ingredient {
key: "banana",
translates: IngredientTranslate {
ru: "банан",
en: Some("banana"),
}
},
Ingredient {
key: "orange",
translates: IngredientTranslate {
ru: "апельсин",
en: Some("orange"),
}
},
];