expression
Separate interrupt notification from deferred work
An interrupt can interrupt ordinary execution to service a hardware event. Keep handler work bounded; hand off longer work through a synchronization mechanism appropriate for the device. This sequential no_std library models event bookkeeping only: it is not interrupt-safe shared storage. A boolean coalesces repeated events intentionally. Expected host stdout (not executed): first: true second: false Common mistake: Assuming every notification remains individually counted, or sharing this ordinary mutable value between the ISR and main without synchronization.
Formal Syntax & Structure
rust syntaxrust
interrupt handler → bounded event state → main loopWorking Example
Example Snippetrust
#![no_std]#[derive(Default)]pub struct Pending(bool);impl Pending { pub fn notify(&mut self) { self.0 = true; } pub fn take(&mut self) -> bool { core::mem::take(&mut self.0) }}