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