pub trait StreamObserver: Send + Sync {
// Required method
fn on_request(&self, stats: &RequestStats);
// Provided methods
fn on_progress(&self, _in_flight: u64, _buffered_bytes: u64) { ... }
fn on_finish(&self, _summary: &StreamSummary) { ... }
}Expand description
Observer that receives streaming metrics.
Implementations must be cheap and non-blocking: on_request is called on the
scheduler task once per completed HTTP request.
Required Methods§
Sourcefn on_request(&self, stats: &RequestStats)
fn on_request(&self, stats: &RequestStats)
Called once for every completed HTTP request.
Provided Methods§
Sourcefn on_progress(&self, _in_flight: u64, _buffered_bytes: u64)
fn on_progress(&self, _in_flight: u64, _buffered_bytes: u64)
Called once per scheduler iteration with the current in-flight request count and undelivered reorder-buffer size. Lets observers track buffer high-water and concurrency saturation live. Default: no-op.
Sourcefn on_finish(&self, _summary: &StreamSummary)
fn on_finish(&self, _summary: &StreamSummary)
Called once when the stream finishes (or is closed early), with the final aggregate summary. Default: no-op.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".