expression
Stop scheduling retries during shutdown
Shutdown must prevent admission of new retry attempts. Existing work still needs a defined cancellation or drain policy. This fixture models only admission; a concurrent implementation must coordinate state changes and task lifecycle. Expected stdout (not executed): true false false Common mistake: Stopping new requests but allowing retry loops to continue indefinitely during shutdown.
Formal Syntax & Structure
rust syntaxrust
!shutdown_requested && remaining_attempts > 0Working Example
Example Snippetrust
fn main() { fn can_schedule(shutdown: bool, remaining: u8) -> bool { !shutdown && remaining > 0 } for (shutdown, remaining) in [(false,2),(true,2),(false,0)] { println!("{}", can_schedule(shutdown,remaining)); }}