Skip to main content

depleted

Function depleted 

Source
pub fn depleted(
    ctx: &Context,
    req: DepletedRequest,
) -> Result<Outcome<Vec<PantryItem>>, CoreError>
Expand description

The items that are low or out of stock, in file order.

An item is returned when PantryItem::is_low says so. When it does not, the answer depends on what there is to go on:

  • No quantity at all: only with DepletedRequest::all, since there is nothing to compare.
  • A quantity, and a low threshold in the same units: is_low has already compared them and said no, so only with DepletedRequest::all.
  • A quantity, and either no threshold or one in units that do not match: the built-in thresholds decide — at or below 100 for g and ml, below 0.5 for kg and l, at or below 1 for anything else, including a bare count.

§Errors

As load.