uniget_screenshots/
lib.rs

1#![doc = include_str!("../README.md")]
2#![warn(
3    clippy::all,
4    clippy::pedantic,
5    rust_2018_idioms,
6    rustdoc::all,
7    rust_2024_compatibility,
8    missing_docs
9)]
10#![allow(clippy::module_name_repetitions)]
11
12#[deprecated(note = "If possible, v2 should be used instead")]
13pub mod v1;
14pub mod v2;
15
16pub use v2::*;
17
18macro_rules! database_url {
19    (v1 $url:literal) => {
20        /// The stringified URL to the official v1 database. Use [`database_url`] to get the URL as a [`url::Url`] struct.
21        pub const DATABASE_URL: &str = $url;
22        #[must_use]
23        /// Get the official v1 URL as a [`url::Url`] struct.
24        pub fn database_url() -> url::Url {
25            unsafe { url::Url::parse(DATABASE_URL).unwrap_unchecked() }
26        }
27    };
28
29    (v2 $url:literal) => {
30        /// The stringified URL to the official v2 database. Use [`database_url`] to get the URL as a [`url::Url`] struct.
31        pub const DATABASE_URL: &str = $url;
32        #[must_use]
33        /// Get the official v2 URL as a [`url::Url`] struct.
34        pub fn database_url() -> url::Url {
35            unsafe { url::Url::parse(DATABASE_URL).unwrap_unchecked() }
36        }
37    };
38}
39
40// The macro is not exported
41#[allow(hidden_glob_reexports)]
42pub(crate) use database_url;