pub struct CardEventBus { /* private fields */ }Expand description
Process-wide fan-out bus. Subscribers are registered once at startup
(from ALC_CARD_SINKS) and stored behind a Mutex so that tests
can swap them out via replace_subscribers_for_test without losing
the singleton identity.
Implementations§
Source§impl CardEventBus
impl CardEventBus
Sourcepub fn new(subscribers: Vec<Arc<dyn CardSubscriber>>) -> Self
pub fn new(subscribers: Vec<Arc<dyn CardSubscriber>>) -> Self
Build a bus from an explicit subscriber list. Used both by the
env loader and by install_event_bus_for_test.
Sourcepub fn stats(&self) -> &Arc<SubscriberStats> ⓘ
pub fn stats(&self) -> &Arc<SubscriberStats> ⓘ
Shared handle to the per-subscriber counters.
Sourcepub fn publish(&self, ev: &CardEvent)
pub fn publish(&self, ev: &CardEvent)
Fan out ev to every registered subscriber serially. Subscriber
failures are counted in SubscriberStats and logged but do not
propagate.
Sourcepub fn publish_to(&self, target: &str, ev: &CardEvent) -> Result<(), String>
pub fn publish_to(&self, target: &str, ev: &CardEvent) -> Result<(), String>
Deliver ev to exactly one subscriber identified by
target URI. Returns Err when no subscriber matches or the
subscriber itself fails (backfill path needs the caller to know).
Sourcepub fn subscriber_uris(&self) -> Vec<String>
pub fn subscriber_uris(&self) -> Vec<String>
List every subscriber URI currently registered on the bus.
Sourcepub fn find_subscriber(&self, uri: &str) -> Option<Arc<dyn CardSubscriber>>
pub fn find_subscriber(&self, uri: &str) -> Option<Arc<dyn CardSubscriber>>
Look up a subscriber by URI (as returned by describe). Returns
None when no subscriber matches. Used by
alc_card_sink_backfill to dispatch has_card checks against a
specific sink.
Auto Trait Implementations§
impl !Freeze for CardEventBus
impl RefUnwindSafe for CardEventBus
impl Send for CardEventBus
impl Sync for CardEventBus
impl Unpin for CardEventBus
impl UnsafeUnpin for CardEventBus
impl UnwindSafe for CardEventBus
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> MaybeSend for Twhere
T: Send,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.