pub struct ModelStore { /* private fields */ }Expand description
Local model cache and lazy downloader.
Implementations§
Source§impl ModelStore
impl ModelStore
pub fn new(root: impl Into<PathBuf>) -> ModelStore
pub fn default_cache_dir() -> Result<PathBuf, Error>
pub fn default_store() -> Result<ModelStore, Error>
pub fn root(&self) -> &Path
pub fn model_path(&self, model: &ModelRef) -> PathBuf
pub fn is_cached(&self, model: &ModelRef) -> bool
Sourcepub async fn ensure_model(
&self,
model: &ModelRef,
allow_download: bool,
) -> Result<PathBuf, Error>
pub async fn ensure_model( &self, model: &ModelRef, allow_download: bool, ) -> Result<PathBuf, Error>
Return the local model path, downloading only when allow_download is true.
pub async fn download_model(&self, model: &ModelRef) -> Result<PathBuf, Error>
Trait Implementations§
Source§impl Clone for ModelStore
impl Clone for ModelStore
Source§fn clone(&self) -> ModelStore
fn clone(&self) -> ModelStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ModelStore
impl !RefUnwindSafe for ModelStore
impl Send for ModelStore
impl Sync for ModelStore
impl Unpin for ModelStore
impl UnsafeUnpin for ModelStore
impl !UnwindSafe for ModelStore
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
Mutably borrows from an owned value. Read more