db_dump/
lib.rs

1//! [![github]](https://github.com/dtolnay/db-dump) [![crates-io]](https://crates.io/crates/db-dump) [![docs-rs]](https://docs.rs/db-dump)
2//!
3//! [github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github
4//! [crates-io]: https://img.shields.io/badge/crates.io-fc8d62?style=for-the-badge&labelColor=555555&logo=rust
5//! [docs-rs]: https://img.shields.io/badge/docs.rs-66c2a5?style=for-the-badge&labelColor=555555&logo=docs.rs
6
7#![doc(html_root_url = "https://docs.rs/db-dump/0.7.11")]
8#![cfg_attr(not(check_cfg), allow(unexpected_cfgs))]
9#![allow(
10    clippy::cast_lossless,
11    clippy::cast_possible_truncation,
12    clippy::doc_markdown,
13    clippy::missing_errors_doc,
14    clippy::missing_panics_doc,
15    clippy::module_name_repetitions,
16    clippy::must_use_candidate,
17    clippy::needless_lifetimes,
18    clippy::too_many_lines,
19    clippy::uninlined_format_args,
20    clippy::unnecessary_map_or,
21    clippy::unreadable_literal,
22    clippy::unseparated_literal_suffix
23)]
24
25extern crate self as db_dump;
26
27mod bool;
28mod date;
29mod datetime;
30mod error;
31mod ignore;
32mod load;
33mod set;
34
35pub mod categories;
36pub mod crate_downloads;
37pub mod crate_owners;
38pub mod crates;
39pub mod crates_categories;
40pub mod crates_keywords;
41pub mod default_versions;
42pub mod dependencies;
43pub mod keywords;
44pub mod metadata;
45pub mod reserved_crate_names;
46pub mod teams;
47pub mod users;
48pub mod version_downloads;
49pub mod versions;
50
51pub use crate::date::Date;
52pub use crate::error::{Error, Result};
53pub use crate::load::{load_all, Loader};
54
55/// A crates.io DB dump with *everything* deserialized into memory. Use
56/// [`Loader`] to load only parts of a dump, which is more efficient.
57///
58/// One of these full dumps can be loaded via [`db_dump::load_all`].
59#[derive(Default)]
60#[non_exhaustive]
61pub struct DbDump {
62    /// <table style="width:initial"><tr>
63    /// <th>categories.csv</th>
64    /// <td>id</td>
65    /// <td>category</td>
66    /// <td>slug</td>
67    /// <td>description</td>
68    /// <td>crates_cnt</td>
69    /// <td>created_at</td>
70    /// <td>path</td>
71    /// </tr></table>
72    pub categories: Vec<categories::Row>,
73
74    /// <table style="width:initial"><tr>
75    /// <th>crate_downloads.csv</th>
76    /// <td>crate_id</td>
77    /// <td>downloads</td>
78    /// </tr></table>
79    pub crate_downloads: Vec<crate_downloads::Row>,
80
81    /// <table style="width:initial"><tr>
82    /// <th>crate_owners.csv</th>
83    /// <td>crate_id</td>
84    /// <td>owner_id</td>
85    /// <td>created_at</td>
86    /// <td>created_by</td>
87    /// <td>owner_kind</td>
88    /// </tr></table>
89    pub crate_owners: Vec<crate_owners::Row>,
90
91    /// <table style="width:initial"><tr>
92    /// <th>crates.csv</th>
93    /// <td>id</td>
94    /// <td>name</td>
95    /// <td>updated_at</td>
96    /// <td>created_at</td>
97    /// <td>description</td>
98    /// <td>homepage</td>
99    /// <td>documentation</td>
100    /// <td>readme</td>
101    /// <td>repository</td>
102    /// <td>max_upload_size</td>
103    /// <td>max_features</td>
104    /// </tr></table>
105    pub crates: Vec<crates::Row>,
106
107    /// <table style="width:initial"><tr>
108    /// <th>crates_categories.csv</th>
109    /// <td>crate_id</td>
110    /// <td>category_id</td>
111    /// </tr></table>
112    pub crates_categories: Vec<crates_categories::Row>,
113
114    /// <table style="width:initial"><tr>
115    /// <th>crates_keywords.csv</th>
116    /// <td>crate_id</td>
117    /// <td>keyword_id</td>
118    /// </tr></table>
119    pub crates_keywords: Vec<crates_keywords::Row>,
120
121    /// <table style="width:initial"><tr>
122    /// <th>default_versions.csv</th>
123    /// <td>crate_id</td>
124    /// <td>version_id</td>
125    /// <td>num_versions</td>
126    /// </tr></table>
127    pub default_versions: Vec<default_versions::Row>,
128
129    /// <table style="width:initial"><tr>
130    /// <th>dependencies.csv</th>
131    /// <td>id</td>
132    /// <td>version_id</td>
133    /// <td>crate_id</td>
134    /// <td>req</td>
135    /// <td>optional</td>
136    /// <td>default_features</td>
137    /// <td>features</td>
138    /// <td>target</td>
139    /// <td>kind</td>
140    /// <td>explicit_name</td>
141    /// </tr></table>
142    pub dependencies: Vec<dependencies::Row>,
143
144    /// <table style="width:initial"><tr>
145    /// <th>keywords.csv</th>
146    /// <td>id</td>
147    /// <td>keyword</td>
148    /// <td>crates_cnt</td>
149    /// <td>created_at</td>
150    /// </tr></table>
151    pub keywords: Vec<keywords::Row>,
152
153    /// <table style="width:initial"><tr>
154    /// <th>metadata.csv</th>
155    /// <td>total_downloads</td>
156    /// </tr></table>
157    pub metadata: metadata::Row,
158
159    /// <table style="width:initial"><tr>
160    /// <th>reserved_crate_names.csv</th>
161    /// <td>name</td>
162    /// </tr></table>
163    pub reserved_crate_names: Vec<reserved_crate_names::Row>,
164
165    /// <table style="width:initial"><tr>
166    /// <th>teams.csv</th>
167    /// <td>id</td>
168    /// <td>login</td>
169    /// <td>github_id</td>
170    /// <td>name</td>
171    /// <td>avatar</td>
172    /// <td>org_id</td>
173    /// </tr></table>
174    pub teams: Vec<teams::Row>,
175
176    /// <table style="width:initial"><tr>
177    /// <th>users.csv</th>
178    /// <td>id</td>
179    /// <td>gh_login</td>
180    /// <td>name</td>
181    /// <td>gh_avatar</td>
182    /// <td>gh_id</td>
183    /// </tr></table>
184    pub users: Vec<users::Row>,
185
186    /// <table style="width:initial"><tr>
187    /// <th>version_downloads.csv</th>
188    /// <td>version_id</td>
189    /// <td>downloads</td>
190    /// <td>date</td>
191    /// </tr></table>
192    pub version_downloads: Vec<version_downloads::Row>,
193
194    /// <table style="width:initial"><tr>
195    /// <th>versions.csv</th>
196    /// <td>id</td>
197    /// <td>crate_id</td>
198    /// <td>num</td>
199    /// <td>updated_at</td>
200    /// <td>created_at</td>
201    /// <td>downloads</td>
202    /// <td>features</td>
203    /// <td>yanked</td>
204    /// <td>license</td>
205    /// <td>crate_size</td>
206    /// <td>published_by</td>
207    /// <td>checksum</td>
208    /// <td>links</td>
209    /// <td>rust_version</td>
210    /// <td>has_lib</td>
211    /// <td>bin_names</td>
212    /// <td>edition</td>
213    /// <td>description</td>
214    /// <td>homepage</td>
215    /// <td>documentation</td>
216    /// <td>repository</td>
217    /// </tr></table>
218    pub versions: Vec<versions::Row>,
219}