Skip to main content

get_parser

Function get_parser 

Source
pub fn get_parser() -> &'static CooklangParser
Expand description

Get the global CooklangParser instance.

The parser is initialized with all extensions enabled and an empty converter (no unit conversions). This allows parsing all recipe features while keeping units as-is without conversions. This function is thread-safe and will only initialize the parser once.

ยงExample

use cooklang_reports::parser::get_parser;

let parser = get_parser();
let (recipe, warnings) = parser.parse("@eggs{2}").into_result().unwrap();