Expand description
crates.io registry client.
Provides access to crates.io via:
- Sparse index protocol (https://index.crates.io) for version lookups
- REST API (https://crates.io/api/v1) for search
All HTTP requests are cached aggressively using ETag/Last-Modified headers.
§Examples
use deps_cargo::CratesIoRegistry;
use deps_core::HttpCache;
use std::sync::Arc;
#[tokio::main]
async fn main() {
let cache = Arc::new(HttpCache::new());
let registry = CratesIoRegistry::new(cache);
let versions = registry.get_versions("serde").await.unwrap();
println!("Latest serde: {}", versions[0].num);
}Structs§
- Crates
IoRegistry - Client for interacting with crates.io registry.
Constants§
- CRATES_
IO_ URL - Base URL for crate pages on crates.io
Functions§
- crate_
url - Returns the URL for a crate’s page on crates.io.