refactor: remove deprecated fn

This commit is contained in:
jiahua 2024-04-30 13:44:19 +08:00
parent 23d16f2858
commit e316c08f14
2 changed files with 0 additions and 38 deletions

View file

@ -1,5 +1,4 @@
use crate::error::WhisperError; use crate::error::WhisperError;
use crate::whisper_state::WhisperState;
use crate::WhisperToken; use crate::WhisperToken;
use std::ffi::{c_int, CStr, CString}; 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<Self, WhisperError> {
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. /// Create a new WhisperContext from a buffer.
/// ///
/// # Arguments /// # Arguments

View file

@ -51,22 +51,6 @@ impl WhisperContext {
Ok(Self::wrap(ctx)) 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<Self, WhisperError> {
let ctx = WhisperInnerContext::new(path)?;
Ok(Self::wrap(ctx))
}
/// Create a new WhisperContext from a buffer. /// Create a new WhisperContext from a buffer.
/// ///
/// # Arguments /// # Arguments