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