From 85edf85e5f7125ba0c054c3ca69af3fdae8efdb4 Mon Sep 17 00:00:00 2001 From: jiahua Date: Tue, 30 Apr 2024 13:47:05 +0800 Subject: [PATCH] refactor: remove deprecated fn --- src/whisper_ctx.rs | 21 --------------------- src/whisper_ctx_wrapper.rs | 15 --------------- 2 files changed, 36 deletions(-) diff --git a/src/whisper_ctx.rs b/src/whisper_ctx.rs index d1c4a50..d43f5e4 100644 --- a/src/whisper_ctx.rs +++ b/src/whisper_ctx.rs @@ -70,27 +70,6 @@ impl WhisperInnerContext { } } - /// Create a new WhisperContext from a buffer. - /// - /// # Arguments - /// * buffer: The buffer containing the model. - /// - /// # Returns - /// Ok(Self) on success, Err(WhisperError) on failure. - /// - /// # C++ equivalent - /// `struct whisper_context * whisper_init_from_buffer_no_state(void * buffer, size_t buffer_size)` - #[deprecated = "Use `new_from_buffer_with_params` instead"] - pub fn new_from_buffer(buffer: &[u8]) -> Result { - let ctx = unsafe { - whisper_rs_sys::whisper_init_from_buffer_no_state(buffer.as_ptr() as _, buffer.len()) - }; - if ctx.is_null() { - Err(WhisperError::InitError) - } else { - Ok(Self { ctx }) - } - } /// Convert the provided text into tokens. /// diff --git a/src/whisper_ctx_wrapper.rs b/src/whisper_ctx_wrapper.rs index cff0237..0e56658 100644 --- a/src/whisper_ctx_wrapper.rs +++ b/src/whisper_ctx_wrapper.rs @@ -51,21 +51,6 @@ impl WhisperContext { Ok(Self::wrap(ctx)) } - /// Create a new WhisperContext from a buffer. - /// - /// # Arguments - /// * buffer: The buffer containing the model. - /// - /// # Returns - /// Ok(Self) on success, Err(WhisperError) on failure. - /// - /// # C++ equivalent - /// `struct whisper_context * whisper_init_from_buffer_no_state(void * buffer, size_t buffer_size)` - #[deprecated = "Use `new_from_buffer_with_params` instead"] - pub fn new_from_buffer(buffer: &[u8]) -> Result { - let ctx = WhisperInnerContext::new_from_buffer(buffer)?; - Ok(Self::wrap(ctx)) - } /// Convert the provided text into tokens. ///