Expand description
crates.io registry client, and the CargoRegistry router dispatching a resolved
alternate/private registry to its own crate::sparse::SparseIndexClient.
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§
- Cargo
Registry - Router in front of crates.io and every resolved alternate/private registry a workspace’s
.cargo/config.tomlhierarchy names. - Crates
IoRegistry - Client for interacting with crates.io registry.
Constants§
- CRATES_
IO_ URL - Base URL for crate pages on crates.io
- REGISTRY
- Display name for crates.io used in not-found and API-response error messages.
Functions§
- crate_
url - Returns the URL for a crate’s page on crates.io.