diff --git a/recipes/src/lib.rs b/recipes/src/lib.rs index 834dc3a..fdc625c 100644 --- a/recipes/src/lib.rs +++ b/recipes/src/lib.rs @@ -15,12 +15,10 @@ pub mod parse; pub mod unit; use std::collections::BTreeMap; -use std::str::FromStr; use chrono::NaiveDate; use uuid::{self, Uuid}; -use parse::*; use unit::*; #[derive(Debug, Clone, PartialEq)] @@ -220,26 +218,6 @@ impl Ingredient { self.amt.measure_type(), ); } - - pub fn parse(s: &str) -> Result { - Ok(match ingredient(abortable_parser::StrIter::new(s)) { - abortable_parser::Result::Complete(_, ing) => ing, - abortable_parser::Result::Abort(e) | abortable_parser::Result::Fail(e) => { - return Err(format!("Failed to parse as Ingredient {:?}", e)) - } - abortable_parser::Result::Incomplete(_) => { - return Err(format!("Incomplete input: {}", s)) - } - }) - } -} - -impl FromStr for Ingredient { - type Err = String; - - fn from_str(s: &str) -> Result { - Ingredient::parse(s) - } } impl std::fmt::Display for Ingredient {