booru_dl/lib.rs
1#![warn(missing_docs)]
2// See: <https://doc.rust-lang.org/rustdoc/unstable-features.html#extensions-to-the-doc-attribute>
3#![cfg_attr(
4 docsrs,
5 feature(doc_cfg, doc_auto_cfg, doc_cfg_hide),
6 doc(cfg_hide(doc))
7)]
8
9//! # Usage
10//!
11//! <div class="warning">
12//!
13//! Note: API is unstable, and may change in `0.x` versions.
14//!
15//! </div>
16//!
17//! ## As a library
18//!
19//! As a library, usually you prefer to use [`scheduler`]
20//! and [`api`] to download images from gelbooru api.
21//!
22//! See [`scheduler::Scheduler#example`] for example.
23//!
24//! ## As a binary
25//!
26//! In addition to the above, you also need [`cli`] to build the command line.
27//!
28//! See `main.rs` to know how to assemble these modules as a binary.
29//!
30//! # Requirements
31//!
32//! This crate use [`reqwest`] to send `https` requests to booru api,
33//! which means [tls] is required.
34//!
35//! So, this crate enables [`reqwest/default-tls`] through [default features],
36//! which has [**this requirement**][reqwest/default-tls:requirement].
37//!
38//! If you don't want to use the default tls(*I mean, system `openssl` on `linux`*),
39//! you can [disable default features][default features],
40//! and enable other tls features like [`rustls-tls`] or [`native-tls-vendored`].
41//! See following [Feature flags](#feature-flags).
42//!
43//! # Feature flags
44//!
45//! - This crate re-exports(*same name*) all `tls` features from `reqwest`.
46//!
47//! See [reqwest#optional-features] for details.
48//!
49//! - `cli`: Enable the command line utility.
50//!
51//! [tls]: https://en.wikipedia.org/wiki/Transport_Layer_Security
52//! [`reqwest/default-tls`]: https://docs.rs/reqwest/0.12/reqwest/tls/index.html#default-tls
53//! [default features]: https://doc.rust-lang.org/stable/cargo/reference/features.html#the-default-feature
54//! [reqwest/default-tls:requirement]: https://github.com/seanmonstar/reqwest/tree/v0.12.5?tab=readme-ov-file#requirements
55//! [reqwest#optional-features]: https://docs.rs/reqwest/0.12/reqwest/#optional-features
56//! [`rustls-tls`]: https://github.com/rustls/rustls
57//! [`native-tls-vendored`]: https://docs.rs/openssl/0.10/openssl/#vendored
58
59#[cfg(not(any(
60 feature = "default-tls",
61 feature = "native-tls",
62 feature = "native-tls-vendored",
63 feature = "native-tls-alpn",
64 feature = "rustls-tls",
65 feature = "rustls-tls-manual-roots",
66 feature = "rustls-tls-webpki-roots",
67 feature = "rustls-tls-native-roots",
68)))]
69// `tls` required for `https` api
70compile_error!("At least one `tls` feature must be enabled");
71
72pub mod api;
73#[cfg(feature = "cli")]
74pub mod cli;
75pub mod scheduler;
76
77pub mod config;
78pub mod download;
79pub mod hash;
80pub mod tool;