mirror of
https://github.com/zaphar/kitchen.git
synced 2025-07-22 19:40:14 -04:00
TODO cleanup
This commit is contained in:
parent
91c3ad603b
commit
c5d5e7e536
@ -56,7 +56,6 @@ fn main() {
|
|||||||
let recipe_file = matches.value_of("INPUT").unwrap();
|
let recipe_file = matches.value_of("INPUT").unwrap();
|
||||||
match cli::parse_recipe(recipe_file) {
|
match cli::parse_recipe(recipe_file) {
|
||||||
Ok(r) => {
|
Ok(r) => {
|
||||||
// TODO(jwall): handle our recipe dump
|
|
||||||
output_recipe_info(r, matches.is_present("ingredients"));
|
output_recipe_info(r, matches.is_present("ingredients"));
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
@ -24,11 +24,8 @@ use std::{
|
|||||||
ops::{Add, Div, Mul, Sub},
|
ops::{Add, Div, Mul, Sub},
|
||||||
};
|
};
|
||||||
|
|
||||||
use abortable_parser::{Result, StrIter};
|
|
||||||
use num_rational::Ratio;
|
use num_rational::Ratio;
|
||||||
|
|
||||||
use crate::parse::measure;
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
/// Volume Measurements for ingredients in a recipe.
|
/// Volume Measurements for ingredients in a recipe.
|
||||||
pub enum VolumeMeasure {
|
pub enum VolumeMeasure {
|
||||||
@ -394,17 +391,6 @@ impl Measure {
|
|||||||
Weight(wm) => wm.plural(),
|
Weight(wm) => wm.plural(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(jwall): Remove this it's unnecessary
|
|
||||||
pub fn parse(input: &str) -> std::result::Result<Self, String> {
|
|
||||||
Ok(match measure(StrIter::new(input)) {
|
|
||||||
Result::Complete(_, measure) => measure,
|
|
||||||
Result::Abort(e) | Result::Fail(e) => {
|
|
||||||
return Err(format!("Failed to parse as Measure {:?}", e))
|
|
||||||
}
|
|
||||||
Result::Incomplete(_) => return Err(format!("Incomplete input: {}", input)),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for Measure {
|
impl Display for Measure {
|
||||||
@ -412,7 +398,6 @@ impl Display for Measure {
|
|||||||
match self {
|
match self {
|
||||||
Volume(vm) => write!(w, "{}", vm),
|
Volume(vm) => write!(w, "{}", vm),
|
||||||
Count(qty) => write!(w, "{}", qty),
|
Count(qty) => write!(w, "{}", qty),
|
||||||
// TODO(jwall): Should I allow auto convert upwards for the grams to kgs?
|
|
||||||
Weight(wm) => write!(w, "{}", wm),
|
Weight(wm) => write!(w, "{}", wm),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user