From c611475bdffb1fad0932c7f529936a76a4826fa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20M=C3=BCller?= Date: Fri, 24 Oct 2025 08:55:08 -0700 Subject: [PATCH] Adjust WhisperState::full() to return () on success It makes no sense for WhisperState::full() to return an int: the only possible returned value is 0. Hence, it adds no information whatsoever. Worse yet, it is confusing everyone using the method. Just return nothing on success. --- src/whisper_state/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/whisper_state/mod.rs b/src/whisper_state/mod.rs index 2210b1f..2b93b4a 100644 --- a/src/whisper_state/mod.rs +++ b/src/whisper_state/mod.rs @@ -280,7 +280,7 @@ impl WhisperState { /// See utilities in the root of this crate for functions to convert audio to this format. /// /// # Returns - /// Ok(c_int) on success, Err(WhisperError) on failure. + /// Ok(()) on success, Err(WhisperError) on failure. /// /// # C++ equivalent /// `int whisper_full_with_state( @@ -289,7 +289,7 @@ impl WhisperState { /// struct whisper_full_params params, /// const float * samples, /// int n_samples)` - pub fn full(&mut self, params: FullParams, data: &[f32]) -> Result { + pub fn full(&mut self, params: FullParams, data: &[f32]) -> Result<(), WhisperError> { if data.is_empty() { // can randomly trigger segmentation faults if we don't check this return Err(WhisperError::NoSamples); @@ -311,7 +311,7 @@ impl WhisperState { } else if ret == 8 { Err(WhisperError::FailedToDecode) } else if ret == 0 { - Ok(ret) + Ok(()) } else { Err(WhisperError::GenericError(ret)) }