mirror of
https://github.com/zaphar/kitchen.git
synced 2025-07-22 19:40:14 -04:00
Remove another unnecessary method
This commit is contained in:
parent
c5d5e7e536
commit
a7923fbcf3
@ -15,12 +15,10 @@ pub mod parse;
|
|||||||
pub mod unit;
|
pub mod unit;
|
||||||
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use std::str::FromStr;
|
|
||||||
|
|
||||||
use chrono::NaiveDate;
|
use chrono::NaiveDate;
|
||||||
use uuid::{self, Uuid};
|
use uuid::{self, Uuid};
|
||||||
|
|
||||||
use parse::*;
|
|
||||||
use unit::*;
|
use unit::*;
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
@ -220,26 +218,6 @@ impl Ingredient {
|
|||||||
self.amt.measure_type(),
|
self.amt.measure_type(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn parse(s: &str) -> Result<Ingredient, String> {
|
|
||||||
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<Self, Self::Err> {
|
|
||||||
Ingredient::parse(s)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Display for Ingredient {
|
impl std::fmt::Display for Ingredient {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user