Tracked under #6.
Scope
Each callback type requires the same trampoline discipline as the existing abort-callback wiring (Box<dyn FnMut> on Params, C-typed trampoline, lifetime story tied to the Params). Wrapping them unlocks streaming partial-result emission and progress UIs.
Symbols
set_progress_callback* — periodic progress (0.0–1.0).
set_new_segment_callback* — fires when a new decoded segment is ready (the underlying mechanism for streaming partial results).
set_filter_logits_callback* — pre-sampling logits filter (advanced).
set_start_encoder_callback* — fires before each encoder invocation.
Why deferred
Whispery's chunk-at-a-time pump emits results at end-of-chunk, not mid-decode. Each callback duplicates the abort-callback pattern; the cost is per-callback, not amortised.
Why this matters more than it looks
The new_segment_callback is the underlying mechanism for streaming partial-result emission — see #4 (async-friendly State::full) and #3 (iterator-based output API). For true mid-decode streaming this callback would need wrapping; the iterator API alone gives end-of-decode results.
Acceptance
Params::set_progress_callback(impl FnMut(f32)) returning WhisperResult<&mut Self>.
Params::set_new_segment_callback(impl FnMut(&Segment<'_>, i32)) — careful: the Segment borrow lifetime is during the callback only.
Params::set_filter_logits_callback(impl FnMut(&[Token], &mut [f32])).
Params::set_start_encoder_callback(impl FnMut()).
- Each lifetime-shape decision documented in the corresponding setter's doc.
- Audit-matrix rows for each new method.
- Unit tests for
set_* (storage / replacement) plus integration tests confirming the callback fires.
If you want streaming partial-result emission, this is the load-bearing piece. Drop a comment.
Tracked under #6.
Scope
Each callback type requires the same trampoline discipline as the existing abort-callback wiring (
Box<dyn FnMut>onParams, C-typed trampoline, lifetime story tied to theParams). Wrapping them unlocks streaming partial-result emission and progress UIs.Symbols
set_progress_callback*— periodic progress (0.0–1.0).set_new_segment_callback*— fires when a new decoded segment is ready (the underlying mechanism for streaming partial results).set_filter_logits_callback*— pre-sampling logits filter (advanced).set_start_encoder_callback*— fires before each encoder invocation.Why deferred
Whispery's chunk-at-a-time pump emits results at end-of-chunk, not mid-decode. Each callback duplicates the abort-callback pattern; the cost is per-callback, not amortised.
Why this matters more than it looks
The
new_segment_callbackis the underlying mechanism for streaming partial-result emission — see #4 (async-friendlyState::full) and #3 (iterator-based output API). For true mid-decode streaming this callback would need wrapping; the iterator API alone gives end-of-decode results.Acceptance
Params::set_progress_callback(impl FnMut(f32))returningWhisperResult<&mut Self>.Params::set_new_segment_callback(impl FnMut(&Segment<'_>, i32))— careful: the Segment borrow lifetime is during the callback only.Params::set_filter_logits_callback(impl FnMut(&[Token], &mut [f32])).Params::set_start_encoder_callback(impl FnMut()).set_*(storage / replacement) plus integration tests confirming the callback fires.If you want streaming partial-result emission, this is the load-bearing piece. Drop a comment.