pub trait ModelSource: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn resolve<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
model_id: &'life1 str,
opts: &'life2 ResolveOptions,
) -> Pin<Box<dyn Future<Output = Result<ModelDir, AsrError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn capabilities_for<'life0, 'life1, 'async_trait>(
&'life0 self,
model_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ModelCapabilities, AsrError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided method
fn list_available<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ModelDescriptor>, AsrError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
A source of models (Hugging Face, a local directory, future registries).
Acquisition is inherently asynchronous (network downloads), so this
trait uses async_trait even though crate::AsrEngine is
sync. The trait requires Send + Sync so a Box<dyn ModelSource>
can move across thread boundaries inside an HTTP server or CLI.
Required Methods§
Sourcefn name(&self) -> &'static str
fn name(&self) -> &'static str
Short, stable identifier for this source
("huggingface", "local", …).
Sourcefn resolve<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
model_id: &'life1 str,
opts: &'life2 ResolveOptions,
) -> Pin<Box<dyn Future<Output = Result<ModelDir, AsrError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn resolve<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
model_id: &'life1 str,
opts: &'life2 ResolveOptions,
) -> Pin<Box<dyn Future<Output = Result<ModelDir, AsrError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Resolve a model id (e.g. Qwen/Qwen3-ASR-0.6B) to a concrete
ModelDir on disk, downloading if necessary.
Sourcefn capabilities_for<'life0, 'life1, 'async_trait>(
&'life0 self,
model_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ModelCapabilities, AsrError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn capabilities_for<'life0, 'life1, 'async_trait>(
&'life0 self,
model_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ModelCapabilities, AsrError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Query a model’s capabilities without downloading the weights.
Provided Methods§
Sourcefn list_available<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ModelDescriptor>, AsrError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_available<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ModelDescriptor>, AsrError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List models known to this source. Defaults to
AsrError::Unsupported because not every source can enumerate.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".