Enum reactive_mutiny::prelude::Instruments
source · #[repr(usize)]pub enum Instruments {
NoInstruments = 0,
LogsWithoutMetrics = 32,
LogsWithMetrics = 103,
LogsWithExpensiveMetrics = 107,
MetricsWithoutLogs = 7,
ExpensiveMetricsWithoutLogs = 11,
Custom(usize),
}Expand description
Honors the Zero-Cost Instrumentation Pattern for the [stream_executors]:
Designed to be used as a const generic parameter for Structs,
causes the conditional instrumentation code in client structs to
be selectively compiled – see the implemented const methods for
documentation of each available instrument.
Note: Using this enum directly in generics –
as in struct S<const INSTUMENTS: Instruments = { Instruments::NoInstruments }> {...}
– is not possible yet (as of Rust 1.64): “adt const params is experimental [E0658]”,
so we’ll use it as struct S<const INSTRUMENTS: usize = 0> instead, and use [Instruments::from(INSTRUMENTS)]
in the instrumentable implementations & let s = S::<Instruments::<YourOption>::into()> {}; in clients.
Variants§
NoInstruments = 0
No conditional instrumentation code will be included – bringing in the fastest possible execution speeds at the expense of lowest operational control
LogsWithoutMetrics = 32
LogsWithMetrics = 103
LogsWithExpensiveMetrics = 107
MetricsWithoutLogs = 7
ExpensiveMetricsWithoutLogs = 11
Custom(usize)
Implementations§
source§impl Instruments
impl Instruments
sourcepub const fn from(instruments: usize) -> Self
pub const fn from(instruments: usize) -> Self
To be used in if conditions, returns the enum variant that corresponds to the given const generic numeric value as described in Self
sourcepub const fn into(self) -> usize
pub const fn into(self) -> usize
designed to be used by clients of the implementor structs, returns the number to be used as a const generic numeric value (when instantiating the implementor struct) that corresponds to the given enum variant
sourcepub const fn logging(self) -> bool
pub const fn logging(self) -> bool
returns whether executors should log start/stop in the INFO level OR events TRACING
sourcepub const fn tracing(self) -> bool
pub const fn tracing(self) -> bool
returns whether executors should log events in the TRACING level
sourcepub const fn cheap_profiling(self) -> bool
pub const fn cheap_profiling(self) -> bool
returns whether executors should compute the CHEAP_PROFILING metrics
Trait Implementations§
source§impl Clone for Instruments
impl Clone for Instruments
source§fn clone(&self) -> Instruments
fn clone(&self) -> Instruments
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for Instruments
impl Debug for Instruments
source§impl PartialEq for Instruments
impl PartialEq for Instruments
impl Copy for Instruments
impl StructuralPartialEq for Instruments
Auto Trait Implementations§
impl Freeze for Instruments
impl RefUnwindSafe for Instruments
impl Send for Instruments
impl Sync for Instruments
impl Unpin for Instruments
impl UnwindSafe for Instruments
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)