Registry / http-client / crates-io-api

crates-io-api

JSON →
library0.12.0rscratesunverified

A Rust client library for querying the crates.io registry API.

# Cargo.toml [dependencies] crates_io_api = "0.12.0"
INSTALL
IMPORT
SIG · CRATES-IO-API
C
crates-io-api
http-clientrustv0.12.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Client
use crates_io_api::Client;

Fetches crate metadata from crates.io using the API client.

use crates_io_api::Client; #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { let client = Client::new("my-user-agent", std::time::Duration::from_secs(10))?; let crate_data = client.get_crate("serde").await?; println!("Latest version: {}", crate_data.crate_data.max_version); Ok(()) }
Debug
Known issues
gotchaRequires an async runtime like Tokio to execute requests.
fix
Add tokio as a dependency and annotate main with #[tokio::main].
affects: >=0.12.0
Upgrade
Version history
0.12.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
24 hits · last 30 days
node
20
OpenAI (training)
1
Resources
crates-io-api — cargo add crates-io-api · libregistry