pub struct Hub {
client: Client,
token: Option<String>,
}Expand description
A Hub client with the optional token every request carries.
Fields§
§client: Client§token: Option<String>Implementations§
Source§impl Hub
impl Hub
pub fn new(token: Option<String>) -> Result<Self, String>
Sourceasync fn get(&self, url: &str) -> Result<Response, String>
async fn get(&self, url: &str) -> Result<Response, String>
One authorised GET, its status checked.
Sourcepub async fn revision(&self, repo: &str) -> Result<String, String>
pub async fn revision(&self, repo: &str) -> Result<String, String>
The repository’s current revision sha. Every file URL is pinned to it, so one install fetches one coherent set.
Sourcepub async fn blobs(
&self,
repo: &str,
revision: &str,
) -> Result<Vec<HubBlob>, String>
pub async fn blobs( &self, repo: &str, revision: &str, ) -> Result<Vec<HubBlob>, String>
Every file the revision publishes, with its LFS digest.
Recursive, because the model and its voices are not at the root.
The plain tree call answers the root’s own entries - onnx and
voices as directories - so a reader that dropped directories would
find no model at all. A page that caps follows its Link header.
Sourcepub async fn download(
&self,
repo: &str,
revision: &str,
blob: &HubBlob,
dest: &Path,
on_bytes: impl FnMut(u64),
) -> Result<(), String>
pub async fn download( &self, repo: &str, revision: &str, blob: &HubBlob, dest: &Path, on_bytes: impl FnMut(u64), ) -> Result<(), String>
Fetch one pinned file, reporting the bytes written so far.
The file lands at dest only once its byte length and, where the
repository publishes one, its digest match; a mismatch leaves nothing
behind.
Auto Trait Implementations§
impl !RefUnwindSafe for Hub
impl !UnwindSafe for Hub
impl Freeze for Hub
impl Send for Hub
impl Sync for Hub
impl Unpin for Hub
impl UnsafeUnpin for Hub
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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