pub struct ModifierChain<T> { /* private fields */ }Expand description
A composed chain of OpFieldModifier<T> — the moral
equivalent of upstream NB Java’s specialized LongFunction<S>.
Built once in the dispenser initializer; called per cycle on
the critical path. Carries an optional ModifierTraceSink for
cross-cutting observation; the sink hot-path is gated lazily
(see Self::apply).
Implementations§
Source§impl<T: 'static> ModifierChain<T>
impl<T: 'static> ModifierChain<T>
Sourcepub fn new(
op_label: impl Into<String>,
active: Vec<Box<dyn OpFieldModifier<T>>>,
event_sink: Option<Arc<dyn ModifierTraceSink>>,
) -> Self
pub fn new( op_label: impl Into<String>, active: Vec<Box<dyn OpFieldModifier<T>>>, event_sink: Option<Arc<dyn ModifierTraceSink>>, ) -> Self
Construct a chain. active MUST already exclude inactive
modifiers; the caller (typically a per-adapter builder
like build_cql_modifier_chain) is responsible for
dropping None results from parent.lookup(...) so this
vec contains only modifiers the user actually bound.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
True when the user did not bind any universal field for
this op. Lets the caller skip the apply call entirely
on a fully-default path — the most common case in practice.
Sourcepub fn op_label(&self) -> &str
pub fn op_label(&self) -> &str
The op label this chain was built for. Used by sinks for event correlation.
Sourcepub fn apply(&self, target: &mut T)
pub fn apply(&self, target: &mut T)
Critical-path entry. Apply every active modifier to the target.
Two arms:
- No sink installed: tight loop over
active. No closure construction, no JSON serialization, no virtual dispatch beyond each modifier’s ownapply. - Sink installed: after each
apply, the sink is handed a&dyn Fn() -> serde_json::Valuethat the sink may or may not invoke. JSON serialization is paid only when the sink actually wants the value (e.g. trace-router has at least one subscriber to this adapter’s traces).
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for ModifierChain<T>
impl<T> !UnwindSafe for ModifierChain<T>
impl<T> Freeze for ModifierChain<T>
impl<T> Send for ModifierChain<T>
impl<T> Sync for ModifierChain<T>
impl<T> Unpin for ModifierChain<T>
impl<T> UnsafeUnpin for ModifierChain<T>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
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> ⓘ
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