Struct crates_io_api::SyncClient [−][src]
pub struct SyncClient { /* fields omitted */ }
Expand description
A synchronous client for the crates.io API.
Implementations
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.
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),
)?;
Retrieve a summary containing crates.io wide information.
Retrieve information of a crate.
If you require detailed information, consider using full_crate.
Retrieve download stats for a crate.
Retrieve the owners of a crate.
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.
Retrieve the authors for a crate version.
Retrieve the dependencies of a crate version.
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.
Retrieve a page of crates, optionally constrained by a query.
If you want to get all results without worrying about paging,
use [all_crates
].
Examples
Retrieve the first page of results for the query “api”, with 100 items per page and sorted alphabetically.
client.crates(ListOptions{
sort: Sort::Alphabetical,
per_page: 100,
page: 1,
query: Some("api".to_string()),
})?;
Auto Trait Implementations
impl !RefUnwindSafe for SyncClient
impl Send for SyncClient
impl Sync for SyncClient
impl Unpin for SyncClient
impl !UnwindSafe for SyncClient
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more