Struct EventBus
pub struct EventBus { /* private fields */ }Expand description
The live event sender plus its history buffer.
Cloning shares both halves. EventBus::install_hook makes this bus the
destination of every observer built by
create_observer; whoever owns
the bus installs it once and holds the guard for as long as it runs.
Implementations§
Source§impl EventBus
impl EventBus
Sourcepub fn with_capacities(channel: usize, history: usize) -> Self
pub fn with_capacities(channel: usize, history: usize) -> Self
A bus with explicit capacities (tests use small ones).
Sourcepub fn sender(&self) -> &Sender<Value>
pub fn sender(&self) -> &Sender<Value>
The live sender. Other publishers (cron, heartbeat, the log layer) send on it directly; those frames are live-only and not buffered.
Sourcepub fn history(&self) -> &Arc<EventBuffer> ⓘ
pub fn history(&self) -> &Arc<EventBuffer> ⓘ
The history buffer the observer fills.
Sourcepub fn install_hook(&self) -> BroadcastHookGuard
pub fn install_hook(&self) -> BroadcastHookGuard
Install this bus’s BroadcastObserver as the process-wide broadcast
hook. The hook stays installed until the returned guard drops.
Source§impl EventBus
impl EventBus
The bus a component should publish on.
shared is a bus whose owner already installed its hook (a gateway
under the daemon): it is reused and no second hook is installed, so
each observer event reaches subscribers once and lands in one history.
With no shared bus (a standalone gateway) a fresh bus is created and
installed, and the caller holds the returned guard while it runs.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EventBus
impl RefUnwindSafe for EventBus
impl Send for EventBus
impl Sync for EventBus
impl Unpin for EventBus
impl UnsafeUnpin for EventBus
impl UnwindSafe for EventBus
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 more