Skip to main content

load

Function load 

Source
pub fn load(ctx: &Context) -> Result<Outcome<PantryContents>, CoreError>
Expand description

Read and parse the pantry configuration Context::pantry names.

Reads through ConfigSource, so an editor can hand over pantry text it has not saved instead of a path.

A pantry that parses with warnings โ€” an unknown attribute on an item, say โ€” is a successful load carrying those warnings as Outcome::diagnostics, located in the pantry file when it came from one.

ยงErrors

  • CoreError::MissingConfig if the context carries no pantry at all. Every query below reports this the same way, because a pantry query with no pantry has no answer โ€” unlike shopping_list::generate, which simply subtracts nothing.
  • CoreError::Io if a path-backed configuration cannot be read.
  • CoreError::Config if it cannot be parsed at all, naming the file it came from.