Skip to main content

pantry_coverage

Function pantry_coverage 

Source
pub fn pantry_coverage(
    ctx: &Context,
    req: CoverageRequest,
) -> Result<Outcome<IngredientCoverage>, CoreError>
Expand description

Check the collection’s ingredients against the pantry configuration Context::pantry names — the question cook doctor pantry asks.

An ingredient is known when an item of that name is in stock, in any section, compared lowercased and otherwise exactly; no quantity or date is considered, so an item that has run out still counts as known. With no pantry configuration nothing is known; see unknown.

Note the direction: this reports on the collection’s ingredients, so a pantry item no recipe uses is not mentioned at all.

§Errors

Exactly as aisle_coverage, except that CoreError::Config is genuinely reachable here — a pantry.conf that is not TOML — and comes back worded identically to pantry::load’s, so that two commands reading one broken file say the same thing about it.