Make WhisperState::new unsafe
This commit is contained in:
parent
7e46c91cbd
commit
814b2b836f
2 changed files with 5 additions and 2 deletions
|
|
@ -421,7 +421,7 @@ impl WhisperContext {
|
|||
Err(WhisperError::InitError)
|
||||
} else {
|
||||
// SAFETY: this is known to be a valid pointer to a `whisper_state` struct
|
||||
Ok(WhisperState::new(self.ctx.clone(), state))
|
||||
Ok(unsafe { WhisperState::new(self.ctx.clone(), state) })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,10 @@ impl Drop for WhisperState {
|
|||
}
|
||||
|
||||
impl WhisperState {
|
||||
pub(crate) fn new(
|
||||
/// # Safety
|
||||
/// * `ptr` must be non-null
|
||||
/// * `ptr` must be a valid pointer to a `whisper_state`.
|
||||
pub(crate) unsafe fn new(
|
||||
ctx: Arc<WhisperInnerContext>,
|
||||
ptr: *mut whisper_rs_sys::whisper_state,
|
||||
) -> Self {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue