pub struct Cache { /* private fields */ }Implementations§
Source§impl Cache
impl Cache
Sourcepub fn with_huggingface_token(self, token: Option<String>) -> Self
pub fn with_huggingface_token(self, token: Option<String>) -> Self
Set the Hugging Face token to use for downloading (defaults to the token set with huggingface-cli login, and then the environment variable HF_TOKEN)
Sourcepub fn exists(&self, source: &FileSource) -> bool
pub fn exists(&self, source: &FileSource) -> bool
Check if the file exists locally (if it is a local file or if it has been downloaded)
Sourcepub async fn get(
&self,
source: &FileSource,
progress: impl FnMut(FileLoadingProgress),
) -> Result<PathBuf, CacheError>
pub async fn get( &self, source: &FileSource, progress: impl FnMut(FileLoadingProgress), ) -> Result<PathBuf, CacheError>
Get the file from the cache, downloading it if necessary
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Cache
impl RefUnwindSafe for Cache
impl Send for Cache
impl Sync for Cache
impl Unpin for Cache
impl UnwindSafe for Cache
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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