summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorBen Bridle <bridle.benjamin@gmail.com>2022-08-25 20:57:37 +1200
committerBen Bridle <bridle.benjamin@gmail.com>2022-08-25 20:57:37 +1200
commit6eee1102918857b11ecc193e684e2438520ef90f (patch)
tree19533d851c646331c38965a2ab3fd91a15f131a3 /src/main.rs
downloadrecipe-43df640b5abd25fc14ada9c03dd0134e3c10ce49.zip
Initial commitv1.0
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..96fac3a
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,22 @@
+use recipe_parser::Recipe;
+
+fn main() {
+ let recipe = Recipe::parse(
+ "Combine {bulghur wheat, 1 cup} and {boiling water, 1 cup, for wheat}. Set aside for 20 minutes. Put {whole-meal flour, 2 cups}, {salt, 2 tsp}, and {yeast, 2 tbsp} in a bowl and stir together. Add {cold water, 1 cup} and {golden syrup, 1 tbsp}, immediately followed by {boiling water, 1 cup}. Stir to a smooth paste and stand for 2 to 3 minutes. Mix in the {egg, 1} and {high-grade flour, 3 cups}, adding the last cup of flour slowly (more or less than the cup may be needed to give a very thick batter, which is not quite as stiff as dough). Mix for 3 to 4 minutes. Cover and put in a warm place for 15 minutes. Stir well and pour into two 22cm greased loaf tins. Put in a warm place until the dough doubles in volume. Bake at 200°C for 35 minutes or until the loaf sounds hollow when tapped on the bottom. If loaf is browning too quickly, cover with foil.",
+ );
+ for i in recipe.ingredients {
+ let unit = match i.unit {
+ Some(unit) => format!("{} of ", unit),
+ None => String::new(),
+ };
+ let addendum = match i.addendum {
+ Some(addendum) => format!(" ({})", addendum),
+ None => String::new(),
+ };
+ println!("- {} {}{}{}", i.quantity, unit, i.name, addendum);
+ }
+ println!();
+ for paragraph in recipe.process {
+ println!("{}\n", paragraph);
+ }
+}