Rust Result, ?, and panic

F-QMARK-V4-2medium

Log only what is missing

A café ordering tool parses quantities, looks up prices and totals each table’s order.

What needs to change

Repair price so a missing item is logged only when it is really missing.

Reproduce

  1. Run rustc --edition=2024 main.rs -o main && ./main with the two-item sample, then compare the first line with the expected stdout.

Acceptance criteria

Your review marks · Saved in this browser. Test acceptance is tracked separately.

Notes

The file contains its use declarations, read_rows, missing, price and main. missing logs a line and is correct.

Input: up to50 records, one opaque UTF-8 item token per LF/CRLF line, with ASCII space/tab/CR framing. Tokens exclude ASCII field and record separators. tea costs 3 and cake 5; every other item is missing.

Sign in to open this exercise

The ticket brief is public. Sign in to access the exercise. Paid exercises require Pro.

Sign in