#[processor]Expand description
Unified macro for defining event processors.
Generates Processor and optional PollingProcessor implementations.
§Parameters
subscribe: Array of event types to subscribe to (required)poll_interval: Optional polling interval in milliseconds
§Examples
ⓘ
// Event-driven processor
#[processor(subscribe = [LedIndicatorEvent])]
struct LedController { /* ... */ }
impl LedController {
async fn on_led_indicator_event(&mut self, event: LedIndicatorEvent) {
// Handle event
}
}
// Polling processor
#[processor(subscribe = [BatteryStatusEvent], poll_interval = 1000)]
struct BatteryMonitor { /* ... */ }
impl BatteryMonitor {
async fn on_battery_status_event(&mut self, event: BatteryStatusEvent) {
// Handle event
}
async fn poll(&mut self) {
// Called every 1000ms
}
}