pub struct EventBus { /* private fields */ }Expand description
Broadcast-based event bus.
Implementations§
Source§impl EventBus
impl EventBus
Sourcepub fn subscribe(&self) -> Receiver<AmagiEvent>
pub fn subscribe(&self) -> Receiver<AmagiEvent>
Subscribe to all future events.
Sourcepub fn emit(&self, event: AmagiEvent)
pub fn emit(&self, event: AmagiEvent)
Emit an arbitrary event.
Sourcepub fn emit_log<S, I>(&self, level: EventLogLevel, message: S, args: I)
pub fn emit_log<S, I>(&self, level: EventLogLevel, message: S, args: I)
Emit a log event at the requested level.
Sourcepub fn emit_http_request(
&self,
method: impl Into<String>,
url: impl Into<String>,
)
pub fn emit_http_request( &self, method: impl Into<String>, url: impl Into<String>, )
Emit an outgoing HTTP request event.
Sourcepub fn emit_http_response(
&self,
method: impl Into<String>,
url: impl Into<String>,
status_code: u16,
response_time_ms: u64,
)
pub fn emit_http_response( &self, method: impl Into<String>, url: impl Into<String>, status_code: u16, response_time_ms: u64, )
Emit a completed HTTP response event.
Sourcepub fn emit_network_retry(
&self,
error_code: impl Into<String>,
attempt: u32,
max_retries: u32,
delay_ms: u64,
url: Option<String>,
)
pub fn emit_network_retry( &self, error_code: impl Into<String>, attempt: u32, max_retries: u32, delay_ms: u64, url: Option<String>, )
Emit a retry attempt event.
Sourcepub fn emit_network_error(
&self,
error_code: impl Into<String>,
message: impl Into<String>,
retries: u32,
url: Option<String>,
)
pub fn emit_network_error( &self, error_code: impl Into<String>, message: impl Into<String>, retries: u32, url: Option<String>, )
Emit a network error event.
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§
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