Expand description
The Runtime type.
Runtimes combine components into a fully encapsulated diagnostic pipeline. Each runtime includes:
- An
Emitterto receive diagnostic events. - A
Filterto limit the volume of diagnostic events. - A
Ctxtto capture and attach ambient state to events. - A
Clockto timestamp events. - A
Rngto generate correlation ids for events.
Runtimes are fully isolated and may be short-lived. A Runtime can be treated generically, or erased behind an AmbientSlot for global sharing. This module defines two global runtimes; the shared() runtime, and the internal() runtime. Applications should emit their events through the shared() runtime. Code running within a runtime itself, such as an implementation of Emitter should emit their events through the internal() runtime.
The internal() runtime can only be initialized with components that also satisfy internal versions of their regular traits. These marker traits require a component not produce any diagnostics of its own, and so are safe to use by another runtime. If components in the internal() runtime could produce their own diagnostics then it could cause loops and stack overflows.
If an application is initializing both the shared() and internal() runtimes, then it should initialize the internal() runtime first.
Structs§
- Ambient
Internal Slot - A type-erased slot for the
internal()runtime. - Ambient
Slot - A type-erased slot for a globally shared
Runtime. - Assert
Internal - Assert that a given component does not emit any diagnostics of its own.
- Runtime
- A diagnostic pipeline.
Traits§
- Internal
Clock - A marker trait for a
Clockthat does not emit any diagnostics of its own. - Internal
Ctxt - A marker trait for a
Ctxtthat does not emit any diagnostics of its own. - Internal
Emitter - A marker trait for an
Emitterthat does not emit any diagnostics of its own. - Internal
Filter - A marker trait for a
Filterthat does not emit any diagnostics of its own. - Internal
Rng - A marker trait for an
Rngthat does not emit any diagnostics of its own.
Functions§
- internal
- The internal runtime for other runtime components to use.
- internal_
slot - The initialization slot for the
internal()runtime. - shared
- The global shared runtime for applications to use.
- shared_
slot - The initialization slot for the
shared()runtime.
Type Aliases§
- Ambient
Clock - A type-erased
Clockfor anAmbientSlot. - Ambient
Ctxt - A type-erased
Ctxtfor anAmbientSlot. - Ambient
Emitter - A type-erased
Emitterfor anAmbientSlot. - Ambient
Filter - A type-erased
Filterfor anAmbientSlot. - Ambient
Rng - A type-erased
Rngfor anAmbientSlot. - Ambient
Runtime - A type-erased
Runtime.