pub fn update(
ctx: &Context,
req: UpdateRequest,
) -> Result<Outcome<PantryContents>, CoreError>Expand description
Change an item already in the pantry and write it back.
Only the attributes set on the request are changed; the rest of the item is
left as it was. There is no way to clear an attribute — None means “leave
it”, not “remove it” — so an item is cleared by removing and adding it.
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::PantryEditif the request sets no attribute at all, since that could only rewrite the file to what it already said; or if there is no such section, or no such item in it. Nothing is written.CoreError::MissingConfigif the context carries no pantry, andCoreError::ReadOnlyConfigif it carries one inline.- As
loadotherwise, plusCoreError::Ioif the file cannot be written.