From e316c08f147c6cbf7680282437c41632a01c174d Mon Sep 17 00:00:00 2001 From: jiahua Date: Tue, 30 Apr 2024 13:44:19 +0800 Subject: [PATCH] refactor: remove deprecated fn --- src/whisper_ctx.rs | 22 ---------------------- src/whisper_ctx_wrapper.rs | 16 ---------------- 2 files changed, 38 deletions(-) diff --git a/src/whisper_ctx.rs b/src/whisper_ctx.rs index 1520f7a..d1c4a50 100644 --- a/src/whisper_ctx.rs +++ b/src/whisper_ctx.rs @@ -1,5 +1,4 @@ use crate::error::WhisperError; -use crate::whisper_state::WhisperState; use crate::WhisperToken; use std::ffi::{c_int, CStr, CString}; @@ -71,27 +70,6 @@ impl WhisperInnerContext { } } - /// Create a new WhisperContext from a file. - /// - /// # Arguments - /// * path: The path to the model file. - /// - /// # Returns - /// Ok(Self) on success, Err(WhisperError) on failure. - /// - /// # C++ equivalent - /// `struct whisper_context * whisper_init_from_file_no_state(const char * path_model)` - #[deprecated = "Use `new_with_params` instead"] - pub fn new(path: &str) -> Result { - let path_cstr = CString::new(path)?; - let ctx = unsafe { whisper_rs_sys::whisper_init_from_file_no_state(path_cstr.as_ptr()) }; - if ctx.is_null() { - Err(WhisperError::InitError) - } else { - Ok(Self { ctx }) - } - } - /// Create a new WhisperContext from a buffer. /// /// # Arguments diff --git a/src/whisper_ctx_wrapper.rs b/src/whisper_ctx_wrapper.rs index 04ecfcb..cff0237 100644 --- a/src/whisper_ctx_wrapper.rs +++ b/src/whisper_ctx_wrapper.rs @@ -51,22 +51,6 @@ impl WhisperContext { Ok(Self::wrap(ctx)) } - /// Create a new WhisperContext from a file. - /// - /// # Arguments - /// * path: The path to the model file. - /// - /// # Returns - /// Ok(Self) on success, Err(WhisperError) on failure. - /// - /// # C++ equivalent - /// `struct whisper_context * whisper_init_from_file_no_state(const char * path_model)` - #[deprecated = "Use `new_with_params` instead"] - pub fn new(path: &str) -> Result { - let ctx = WhisperInnerContext::new(path)?; - Ok(Self::wrap(ctx)) - } - /// Create a new WhisperContext from a buffer. /// /// # Arguments