gigastt_core/runtime/factory.rs
1use super::{error::RuntimeError, session::RuntimeSession};
2
3/// Creates a `Runtime` configured for a specific execution provider.
4pub trait RuntimeFactory: Send + Sync + 'static {
5 fn create(&self, intra_threads: usize) -> Result<Box<dyn Runtime>, RuntimeError>;
6
7 /// Returns a CPU-only factory suitable for small auxiliary models.
8 fn cpu_fallback(&self) -> Box<dyn RuntimeFactory>;
9}
10
11/// Owns loaded sessions. One runtime per `Engine`.
12pub trait Runtime: Send + Sync + 'static {
13 fn load_session(
14 &self,
15 model_path: &std::path::Path,
16 is_encoder: bool,
17 ) -> Result<Box<dyn RuntimeSession>, RuntimeError>;
18}