pub fn remove(
ctx: &Context,
req: RemoveRequest,
) -> Result<Outcome<PantryContents>, CoreError>Expand description
Take an item out of the pantry and write it back.
A section left with no items is removed too, because cooklang drops empty
sections when it reads a file and keeping one would not survive the next
read anyway.
Returns the pantry as it now stands on disk, and any warnings from parsing what was there before.
Only the entry asked for is touched; see what a write touches.
ยงErrors
CoreError::MissingConfigif the context carries no pantry: there is nothing to take an item out of. Unlikeadd, this does not create one.CoreError::ReadOnlyConfigif it carries the pantry inline.CoreError::PantryEditif there is no such section, or no such item in it. Nothing is written.- As
loadotherwise, plusCoreError::Ioif the file cannot be written.