expression
Distinguish rejected requests from uncertain outcomes
A lost response does not establish that the server discarded the request. Decide whether an additional attempt is allowed using the application contract, including duplicate handling. This is a conservative toy decision table, not a classification of all socket errors. Expected stdout (not executed): reconcile eligible eligible stop Common mistake: Inferring that a request was not processed from a transport timeout.
Formal Syntax & Structure
rust syntaxrust
match (outcome, repeat_safe)Working Example
Example Snippetrust
fn main() { #[derive(Clone, Copy)] enum Outcome { NotSent, Unknown, Rejected } fn next(outcome: Outcome, repeat_safe: bool) -> &'static str { match (outcome, repeat_safe) { (Outcome::NotSent, _) | (Outcome::Unknown, true) => "eligible", (Outcome::Unknown, false) => "reconcile", (Outcome::Rejected, _) => "stop", } } println!("{}", next(Outcome::Unknown, false)); println!("{}", next(Outcome::Unknown, true)); println!("{}", next(Outcome::NotSent, false)); println!("{}", next(Outcome::Rejected, true));}