pub struct ModelSpec {
pub variant: &'static str,
pub kind_label: &'static str,
pub default_subdir: &'static str,
pub required_files: &'static [&'static str],
pub env_var: &'static str,
pub install_command: &'static str,
pub model_flag: &'static str,
pub source: ModelSource,
}Expand description
Fully describes a model variant’s storage, install transport, and CLI
surface. Static lifetime: every field is &'static str (or
&'static [&'static str]) so ModelSpec is Copy and 'static.
Fields§
§variant: &'static strCLI-facing variant identifier: "whisper-tiny.en" or
"speaker-wespeaker-en". Matches the --variant value the user
passes to voice install-model.
kind_label: &'static strHuman label used in error messages: "Whisper" or "Speaker".
default_subdir: &'static strSubdirectory beneath ~/.omni-dev/voice/models/ where this
model’s files live.
required_files: &'static [&'static str]Files that must exist in the install directory for the model to be considered installed.
env_var: &'static strEnvironment-variable override for the install directory.
install_command: &'static strRecommended install-model invocation, used verbatim in the
ensure_model_present error hint.
model_flag: &'static strCLI flag that overrides the model path on consumer commands,
e.g. "--model" (Whisper) or "--speaker-model" (wespeaker).
source: ModelSourceHow to fetch the bytes.
Implementations§
Source§impl ModelSpec
impl ModelSpec
Sourcepub fn default_dir(&self) -> Option<PathBuf>
pub fn default_dir(&self) -> Option<PathBuf>
Default install directory: ~/.omni-dev/voice/models/<default_subdir>/.
None when the user’s home directory cannot be located — same
failure mode as dirs::home_dir().
Sourcepub fn resolve_dir(&self, override_path: Option<&Path>) -> Result<PathBuf>
pub fn resolve_dir(&self, override_path: Option<&Path>) -> Result<PathBuf>
Resolves the install directory for this spec.
Priority: override_path → env var → default. The returned path
is not validated for existence; pair with Self::ensure_present
for fail-fast.
Sourcepub fn required_files_in(&self, dir: &Path) -> Vec<PathBuf>
pub fn required_files_in(&self, dir: &Path) -> Vec<PathBuf>
Returns the absolute path of each required file inside dir.
Sourcepub fn ensure_present(&self, dir: &Path) -> Result<()>
pub fn ensure_present(&self, dir: &Path) -> Result<()>
Verifies that dir contains every file in self.required_files.
On failure, returns the install hint shaped for this spec (the
install_command / model_flag baked into the spec).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ModelSpec
impl RefUnwindSafe for ModelSpec
impl Send for ModelSpec
impl Sync for ModelSpec
impl Unpin for ModelSpec
impl UnsafeUnpin for ModelSpec
impl UnwindSafe for ModelSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more