#![doc = include_str!("../examples/water.txt")]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
mod ast;
mod error;
mod models;
mod parser;
mod utils;
use std::str::FromStr;
#[doc(inline)]
pub use error::*;
#[doc(inline)]
pub use models::*;
use parser::RecipeParser;
impl Recipe {
#[cfg(feature = "diagnostics")]
pub fn parse(src: &str) -> Result<Self> {
RecipeParser::new(src)
.parse_recipe()
.map_err(|e| e.with_src(src.to_owned()))
}
#[cfg(not(feature = "diagnostics"))]
pub fn parse(src: &str) -> Result<Self> {
RecipeParser::new(src).parse_recipe()
}
}
impl FromStr for Recipe {
type Err = Error;
fn from_str(src: &str) -> Result<Self> {
Recipe::parse(src)
}
}