Trait QlogSink
pub trait QlogSink:
Send
+ Sync
+ 'static {
// Required method
fn emit(&self, event: &QlogEventView<'_>) -> bool;
// Provided methods
fn is_enabled(&self) -> bool { ... }
fn generation(&self) -> u64 { ... }
fn filtered<F>(self, predicate: F) -> Filtered<Self, F>
where Self: Sized,
F: Fn(&QlogEventView<'_>) -> bool + Send + Sync + 'static { ... }
fn filtered_by<F>(self, predicate: F) -> Filtered<Self, F>
where F: QlogFilter,
Self: Sized { ... }
}quic and std only.Expand description
Borrowed observations delivered synchronously inside the QUIC state machine.
Every method must finish promptly: no blocking I/O, waiting for locks/capacity, or expensive
computation. Do not reenter the emitting connection: its state lock may already be held.
Lightweight counters and streaming compact encoders can inspect borrowed fields
directly. Use super::QlogRecorder for output that can wait; it reserves capacity before
acquiring owned data. Custom implementations are responsible for respecting this contract.
The event and its borrowed fields are valid only for the callback. To retain them, explicitly
acquire ownership with event.to_owned() after checking your storage/admission limits.
Tuples deliver to both enabled sinks, including when either sink rejects an observation.
Required Methods§
fn emit(&self, event: &QlogEventView<'_>) -> bool
fn emit(&self, event: &QlogEventView<'_>) -> bool
Inspect an event without retaining its borrows.
Return true when handled (including deliberate filtering), or false on capacity/error
rejection. Rejection invalidates cached recovery snapshots so a later observation can retry.
Provided Methods§
fn is_enabled(&self) -> bool
fn is_enabled(&self) -> bool
Cheap gate checked before constructing a borrowed view. Defaults to enabled.
fn generation(&self) -> u64
fn generation(&self) -> u64
Increment when recording selection changes to request a fresh recovery snapshot. Sinks with fixed selection may keep the default.
fn filtered<F>(self, predicate: F) -> Filtered<Self, F>
fn filtered<F>(self, predicate: F) -> Filtered<Self, F>
Select events without acquiring ownership. The predicate runs on the transport task and
must also be cheap and nonblocking. For mutable selection state, use Self::filtered_by
with a QlogFilter that advances its generation.
fn filtered_by<F>(self, predicate: F) -> Filtered<Self, F>where
F: QlogFilter,
Self: Sized,
fn filtered_by<F>(self, predicate: F) -> Filtered<Self, F>where
F: QlogFilter,
Self: Sized,
Wrap this sink with a filter whose generation reports dynamic selection changes.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".