pub struct TranscriptSnapshotSink { /* private fields */ }Expand description
Receiver of transcript progress snapshots from
Engine::transcribe_streaming (and the serve layer built on it).
The closure receives the full emerging transcript text — committed
segments plus the pending partials, in order — each time it changes; a
snapshot is a full replacement, not a delta, so a consumer can simply
overwrite whatever it is displaying. It reports whether its consumer is
still listening: returning false (e.g. the channel to the HTTP client
is closed) cancels the session and ends the transcription early.
The closure runs on a helper thread and must be cheap and Send: hand
the text off (a channel send) and return.
Implementations§
Source§impl TranscriptSnapshotSink
impl TranscriptSnapshotSink
pub fn new(callback: impl FnMut(&str) -> bool + Send + 'static) -> Self
Sourcepub fn emit(&mut self, text: &str) -> bool
pub fn emit(&mut self, text: &str) -> bool
Delivers one snapshot through the sink: the method a custom
Transcribe implementation calls when
it generates its own progress (a stand-in engine, or a wrapper that
replays progress from elsewhere). The return value reports whether
the consumer is still listening; false should end the
transcription early.