pub struct PredictionStream { /* private fields */ }Expand description
An async stream that yields Predictions by combining a sample receiver
with a concurrent predictor handle.
For each Sample received from the channel,
the stream queries the shared model via the Predictor and yields
a Prediction containing both raw and transformed outputs.
The stream terminates when the underlying SampleReceiver is exhausted
(all senders dropped and channel drained).
§Implementation
Implements futures_core::Stream directly. The predictor acquires a
read lock on the shared model for each prediction, so predictions reflect
the model state at the moment of polling — not the state when the sample
was sent. This is intentional for streaming evaluation.
Implementations§
Source§impl PredictionStream
impl PredictionStream
Sourcepub fn new(receiver: SampleReceiver, predictor: Predictor) -> Self
pub fn new(receiver: SampleReceiver, predictor: Predictor) -> Self
Create a new prediction stream from a sample receiver and predictor.
The receiver provides incoming samples; the predictor queries the shared model for each one.