pub trait CardSubscriber: Send + Sync {
// Required methods
fn on_event(&self, ev: &CardEvent) -> Result<(), String>;
fn describe(&self) -> String;
// Provided method
fn has_card(&self, _card_id: &str) -> Result<bool, String> { ... }
}Expand description
A downstream backend that receives CardEvents in best-effort,
serial fan-out order.
Implementations must be Send + Sync so that the bus can hold
Arc<dyn CardSubscriber> safely across threads.
Required Methods§
Provided Methods§
Sourcefn has_card(&self, _card_id: &str) -> Result<bool, String>
fn has_card(&self, _card_id: &str) -> Result<bool, String>
Best-effort check for whether card_id already exists in this
subscriber. Used by alc_card_sink_backfill to skip cards that
are already mirrored (drift-safe: we never overwrite).
Default implementation returns Ok(false) so subscribers that
cannot cheaply answer (e.g. future network-backed sinks) always
get the push. Override when a cheap local check is possible.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".