crate_index/
lib.rs

1#![deny(clippy::all, missing_docs)]
2#![warn(clippy::pedantic)]
3
4//! Crate-Index is a library for managing and manipulating a Cargo crate
5//! registry.
6//!
7//! *see the [cargo docs](https://doc.rust-lang.org/cargo/reference/registries.html#running-a-registry) for details*
8//!
9//! # Basic Usage
10//! ```no_run
11//! use crate_index::{Index, Url, Metadata, Version};
12//! # use crate_index::Error;
13//!
14//! # async {
15//! // Create a new index, backed by the filesystem and a git repository
16//! let root = "/index";
17//! let download = "https://my-crates-server.com/api/v1/crates/{crate}/{version}/download";
18//!
19//! let mut index = Index::initialise(root, download)
20//!     .build()
21//!     .await?;
22//!
23//! // Create a new crate 'Metadata' object
24//! let name = "foo";
25//! let version = Version::parse("0.1.0").unwrap();
26//! let check_sum = "d867001db0e2b6e0496f9fac96930e2d42233ecd3ca0413e0753d4c7695d289c";
27//!
28//! let metadata = Metadata::new(name, version, check_sum);
29//!
30//! // Insert the Metadata into the index
31//! index.insert(metadata).await?;
32//!
33//! # Ok::<(), Error>(())
34//! # };
35//! ```
36
37mod error;
38pub use error::{Error, Result};
39
40mod metadata;
41pub use metadata::Metadata;
42
43pub mod index;
44
45#[doc(inline)]
46pub use index::Index;
47
48mod validate;
49
50mod utils;
51
52pub use semver::Version;
53pub use url::Url;
54
55#[cfg(feature = "blocking")]
56pub mod blocking;