/// Publish an event. This is the main interface that client code will
/// use.
///
/// If `init_stream` has not been called already, this function will
/// be a no-op.
// NOTE: we can take advantage of this to "disable" the event
// subsystem if users don't wish to send events out; just don't call
// `init_stream` if they don't want it.
Publish an event. This is the main interface that client code will
use.

If `init_stream` has not been called already, this function will
be a no-op.
NOTE: we can take advantage of this to "disable" the event
subsystem if users don't wish to send events out; just don't call
`init_stream` if they don't want it.
Publish an event . This is the main interface that client code will use . If ` init_stream ` has not been called already this function will be a no - op . NOTE : we can take advantage of this to " disable " the event subsystem if users don ' t wish to send events out ; just don ' t call ` init_stream ` if they don ' t want it .
pub fn publish(event: &impl Event) {
    // TODO: incorporate the current timestamp into the rendered event
    // (which will require tweaks to the rendering logic, but we know
    // that'll need to be updated anyway).
    // We render the event to bytes here, rather than over in the
    // publication thread, because it allows our Event types to deal
    // with references, which means less allocations and unnecessary
    // copying (otherwise, we'd have to have copies of everything to
    // send it over to the other thread, or much more complicated
    // thread-safe types!). It also makes the publication thread logic
    // a bit simpler; it just takes bytes and sends them out.
    if let Some(e) = EVENT_STREAM.try_get::<EventStream>() {
        e.send(event.render(EVENT_CORE.get::<EventCore>()));
    }
}
pub fn publish ( event : & impl Event ) { // TODO: incorporate the current timestamp into the rendered event // (which will require tweaks to the rendering logic, but we know // that'll need to be updated anyway). // We render the event to bytes here, rather than over in the // publication thread, because it allows our Event types to deal // with references, which means less allocations and unnecessary // copying (otherwise, we'd have to have copies of everything to // send it over to the other thread, or much more complicated // thread-safe types!). It also makes the publication thread logic // a bit simpler; it just takes bytes and sends them out. if let Some ( e ) = EVENT_STREAM . try_get :: < EventStream > ( ) { e . send ( event . render ( EVENT_CORE . get :: < EventCore > ( ) ) ) ; } }
Publish an event.
Publish an event .
event
&impl Event