pub struct EventBus<I> { /* private fields */ }Expand description
One client’s live event bus. The client owns this value and passes writers down.
Implementations§
Source§impl<I> EventBus<I>
impl<I> EventBus<I>
pub fn new() -> Self
Sourcepub fn subscribe(
&self,
filter: EventFilter<I>,
queue_depth: Option<usize>,
) -> Subscription<I>
pub fn subscribe( &self, filter: EventFilter<I>, queue_depth: Option<usize>, ) -> Subscription<I>
Registers before returning. None gives an internal worker an unbounded queue.
Sourcepub fn subscribe_app(&self, filter: EventFilter<I>) -> Option<Subscription<I>>
pub fn subscribe_app(&self, filter: EventFilter<I>) -> Option<Subscription<I>>
Register an app listener while the client is open.
Sourcepub fn close_app_subscriptions(&self)
pub fn close_app_subscriptions(&self)
End app listeners before worker shutdown begins.
Sourcepub fn close_internal_subscriptions(&self)
pub fn close_internal_subscriptions(&self)
End legacy and other internal listeners after worker shutdown.
Sourcepub fn with_buffer<R, E>(
&self,
f: impl FnOnce(&EventBuffer<'_, I>) -> Result<R, E>,
) -> Result<R, E>where
I: Clone,
pub fn with_buffer<R, E>(
&self,
f: impl FnOnce(&EventBuffer<'_, I>) -> Result<R, E>,
) -> Result<R, E>where
I: Clone,
Runs one synchronous emitting write. Flush follows a successful commit only.
Trait Implementations§
Source§impl<I> EventWriter<I> for EventBus<I>
impl<I> EventWriter<I> for EventBus<I>
fn emit_with_context( &self, client: Option<ClientEvent>, internal: Option<I>, context: EventContext, )
fn emit(&self, client: Option<ClientEvent>, internal: Option<I>)
Auto Trait Implementations§
impl<I> Freeze for EventBus<I>
impl<I> !RefUnwindSafe for EventBus<I>
impl<I> Send for EventBus<I>where
I: Send,
impl<I> Sync for EventBus<I>where
I: Send,
impl<I> Unpin for EventBus<I>
impl<I> UnsafeUnpin for EventBus<I>
impl<I> !UnwindSafe for EventBus<I>
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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