Skip to main content

Module registry

Module registry 

Source
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:

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§

CargoRegistry
Router in front of crates.io and every resolved alternate/private registry a workspace’s .cargo/config.toml hierarchy names.
CratesIoRegistry
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.