Struct crates_io_api::AsyncClient [−][src]
pub struct AsyncClient { /* fields omitted */ }
Expand description
Asynchronous client for the crates.io API.
Implementations
impl Client
[src]
impl Client
[src]pub fn new(
user_agent: &str,
rate_limit: Duration
) -> Result<Self, InvalidHeaderValue>
[src]
pub fn new(
user_agent: &str,
rate_limit: Duration
) -> Result<Self, InvalidHeaderValue>
[src]Instantiate a new client.
To respect the offical Crawler Policy, you must specify both a descriptive user agent and a rate limit interval.
At most one request will be executed in the specified duration. The guidelines suggest 1 per second or less. (Only one request is executed concurrenly, even if the given Duration is 0).
Example user agent: "my_bot (my_bot.com/info)"
or "my_bot (help@my_bot.com)"
.
let client = crates_io_api::AsyncClient::new( "my_bot (help@my_bot.com)", std::time::Duration::from_millis(1000), )?;
pub async fn summary(&self) -> Result<Summary, Error>
[src]
pub async fn summary(&self) -> Result<Summary, Error>
[src]Retrieve a summary containing crates.io wide information.
pub async fn get_crate(&self, name: &str) -> Result<CrateResponse, Error>
[src]
pub async fn get_crate(&self, name: &str) -> Result<CrateResponse, Error>
[src]Retrieve information of a crate.
If you require detailed information, consider using full_crate.
pub async fn crate_downloads(&self, name: &str) -> Result<Downloads, Error>
[src]
pub async fn crate_downloads(&self, name: &str) -> Result<Downloads, Error>
[src]Retrieve download stats for a crate.
pub async fn crate_owners(&self, name: &str) -> Result<Vec<User>, Error>
[src]
pub async fn crate_owners(&self, name: &str) -> Result<Vec<User>, Error>
[src]Retrieve the owners of a crate.
pub async fn crate_reverse_dependencies(
&self,
name: &str
) -> Result<ReverseDependencies, Error>
[src]
pub async fn crate_reverse_dependencies(
&self,
name: &str
) -> Result<ReverseDependencies, Error>
[src]Load all reverse dependencies of a crate.
Note: Since the reverse dependency endpoint requires pagination, this will result in multiple requests if the crate has more than 100 reverse dependencies.
pub async fn crate_authors(
&self,
name: &str,
version: &str
) -> Result<Authors, Error>
[src]
pub async fn crate_authors(
&self,
name: &str,
version: &str
) -> Result<Authors, Error>
[src]Retrieve the authors for a crate version.
pub async fn crate_dependencies(
&self,
name: &str,
version: &str
) -> Result<Vec<Dependency>, Error>
[src]
pub async fn crate_dependencies(
&self,
name: &str,
version: &str
) -> Result<Vec<Dependency>, Error>
[src]Retrieve the dependencies of a crate version.
pub fn full_crate(
&self,
name: &str,
all_versions: bool
) -> impl Future<Output = Result<FullCrate, Error>>
[src]
pub fn full_crate(
&self,
name: &str,
all_versions: bool
) -> impl Future<Output = Result<FullCrate, Error>>
[src]Retrieve all available information for a crate, including download stats, owners and reverse dependencies.
The all_versions
argument controls the retrieval of detailed version
information.
If false, only the data for the latest version will be fetched, if true,
detailed information for all versions will be available.
Note: Each version requires two extra requests.
pub fn crates(
&self,
spec: ListOptions
) -> impl Future<Output = Result<CratesResponse, Error>>
[src]
pub fn crates(
&self,
spec: ListOptions
) -> impl Future<Output = Result<CratesResponse, Error>>
[src]Retrieve a page of crates, optionally constrained by a query.
If you want to get all results without worrying about paging,
use [all_crates
].
pub fn all_crates(
&self,
query: Option<String>
) -> impl Stream<Item = Result<Crate, Error>>
[src]
pub fn all_crates(
&self,
query: Option<String>
) -> impl Stream<Item = Result<Crate, Error>>
[src]Retrieve all crates, optionally constrained by a query.
Note: This method fetches all pages of the result. This can result in a lot queries (100 results per query).
pub fn all_crates_full(
&self,
query: Option<String>,
all_versions: bool
) -> impl Stream<Item = Result<FullCrate, Error>>
[src]
pub fn all_crates_full(
&self,
query: Option<String>,
all_versions: bool
) -> impl Stream<Item = Result<FullCrate, Error>>
[src]Retrieve all crates with all available extra information.
Note: This method fetches not only all crates, but does multiple requests for each crate to retrieve extra information.
This can result in A LOT of queries.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more