pub struct LocalSource { /* private fields */ }Expand description
A voxora_traits::ModelSource that resolves model ids against a
directory already on disk.
Constructed via LocalSource::new:
use voxora_local::LocalSource;
use voxora_traits::ModelSource;
let source = LocalSource::new("/srv/models");
let dir = source.resolve("org/repo/model.bin", &Default::default()).await?;
println!("model at {}", dir.entry.expect("entry").display());resolve joins root_dir with model_id (using PathBuf::join,
which already normalises trailing slashes), checks the resulting
path with std::path::Path::is_file (which follows symlinks on
Unix), and returns a voxora_traits::ModelDir with entry set
to the absolute-or-relative file path matching the input root’s
absoluteness. If the file is missing, the error is
voxora_traits::AsrError::ModelNotFound naming both the missing
path and the configured root.
The implementation never touches the network and never reads
outside root_dir + model_id. Callers wanting a richer
capabilities answer than ModelCapabilities::UNKNOWN should do it
themselves — see voxora-hf for an example of synthesising
capabilities from a filename pattern.
Implementations§
Source§impl LocalSource
impl LocalSource
Sourcepub fn new(root: impl Into<PathBuf>) -> Self
pub fn new(root: impl Into<PathBuf>) -> Self
Build a source that resolves model ids against root.
The root is stored verbatim — no canonicalize, no
existence check. An empty directory listing at resolve time
surfaces as AsrError::ModelNotFound, not as a constructor
failure. Trailing slashes are folded by PathBuf::join, so
new("/srv/models/") and new("/srv/models") behave
identically.
Absolute and relative roots are both supported; the entry
field on the returned ModelDir inherits the same prefix
(absolute root → absolute entry, relative root → relative
entry). Most callers want an absolute root.
Trait Implementations§
Source§impl Clone for LocalSource
impl Clone for LocalSource
Source§fn clone(&self) -> LocalSource
fn clone(&self) -> LocalSource
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LocalSource
impl Debug for LocalSource
Source§impl ModelSource for LocalSource
impl ModelSource for LocalSource
Source§fn name(&self) -> &'static str
fn name(&self) -> &'static str
"huggingface", "local", …).Source§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 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,
Qwen/Qwen3-ASR-0.6B) to a concrete
ModelDir on disk, downloading if necessary.Source§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,
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,
Source§fn list_available<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ModelDescriptor>, AsrError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn list_available<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<ModelDescriptor>, AsrError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
AsrError::Unsupported because not every source can enumerate.