pub struct Client { /* private fields */ }Expand description
A client of npm registries: blocking, so a host runs it on a thread of its own.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(timeout: Duration) -> Self
pub fn new(timeout: Duration) -> Self
A client whose every request, its body read whole, takes at most timeout.
Sourcepub fn metadata(
&self,
registry: &str,
pack: &PackName,
) -> Result<Metadata, String>
pub fn metadata( &self, registry: &str, pack: &PackName, ) -> Result<Metadata, String>
pack’s abbreviated metadata at registry, as it answered.
§Errors
When the registry gives no answer, or its body can’t be read.
Sourcepub fn versions(&self, registry: &str, pack: &PackName) -> Answer
pub fn versions(&self, registry: &str, pack: &PackName) -> Answer
pack’s versions at registry, from its abbreviated metadata: Answer::Versions, or Answer::Failed.
Sourcepub fn search(
&self,
registry: &str,
scope: &str,
) -> Result<Vec<PackName>, String>
pub fn search( &self, registry: &str, scope: &str, ) -> Result<Vec<PackName>, String>
The packs of scope (@kit) that registry’s search lists (search_path), in its order.
§Errors
When the registry gives no answer, answers with an error (a registry without search does), or its answer isn’t a search’s.
Sourcepub fn tarball(
&self,
registry: &str,
version: &VersionInfo,
max_bytes: u64,
) -> Answer
pub fn tarball( &self, registry: &str, version: &VersionInfo, max_bytes: u64, ) -> Answer
version’s tarball from registry’s origin, at most max_bytes of it: Answer::Tarball, or
Answer::Failed.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
impl Forget for Client
impl Freeze for Clientwhere
*const ArcInner<Config> is !null: Freeze,
PhantomData<ArcInner<Config>>: Freeze,
*const ArcInner<ConnectionPool> is !null: Freeze,
PhantomData<ArcInner<ConnectionPool>>: Freeze,
*const ArcInner<dyn Resolver> is !null: Freeze,
PhantomData<ArcInner<dyn Resolver>>: Freeze,
*const ArcInner<dyn Fn(&ConnectionDetails<'_>) -> Result<Box<dyn Transport>, Error> + Sync + Send> is !null: Freeze,
PhantomData<ArcInner<dyn Fn(&ConnectionDetails<'_>) -> Result<Box<dyn Transport>, Error> + Sync + Send>>: Freeze,
impl Move for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Clientwhere
*const ArcInner<Config> is !null: UnsafeUnpin,
PhantomData<ArcInner<Config>>: UnsafeUnpin,
*const ArcInner<ConnectionPool> is !null: UnsafeUnpin,
PhantomData<ArcInner<ConnectionPool>>: UnsafeUnpin,
*const ArcInner<dyn Resolver> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Resolver>>: UnsafeUnpin,
*const ArcInner<dyn Fn(&ConnectionDetails<'_>) -> Result<Box<dyn Transport>, Error> + Sync + Send> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Fn(&ConnectionDetails<'_>) -> Result<Box<dyn Transport>, Error> + Sync + Send>>: UnsafeUnpin,
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,
impl<T> ErasedDestructor for Twhere
T: 'static,
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