Skip to content

Commit

Permalink
impl: model cloning
Browse files Browse the repository at this point in the history
  • Loading branch information
pedro-devv committed Feb 5, 2024
1 parent f8c905f commit 904715e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions crates/whisper_cpp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,18 @@ impl WhisperModel {
}
}

impl Clone for WhisperModel {
/// Makes a clone of the [`WhisperModel`].
///
/// This creates another pointer to the same allocation, it does **NOT** allocate the same model
/// again in memory.
fn clone(&self) -> Self {
Self {
context: self.context.clone(),
}
}
}

#[derive(Clone, Deref, DerefMut)]
struct WhisperState(*mut whisper_state);

Expand Down

0 comments on commit 904715e

Please sign in to comment.