Skip to main content

parse_recipe

Function parse_recipe 

Source
pub fn parse_recipe(
    text: &str,
    name: &str,
    scale: f64,
) -> Result<Outcome<Recipe>, CoreError>
Expand description

Parse recipe text, scale it, and collect diagnostics.

name identifies the recipe in error messages. scale is the scaling factor; pass 1.0 to leave quantities alone.

Returns CoreError::Parse when the recipe has errors, since no recipe can be produced in that case. Warnings come back in the Outcome.

ยงScale

scale must be finite; NaN and infinity give CoreError::InvalidScale. Zero and negative factors are accepted, matching what the CLI does today.