Skip to main content

deboa_smol/
lib.rs

1#![doc = include_str!("../README.md")]
2#![deny(missing_docs)]
3#[cfg(all(
4    feature = "rust-tls",
5    not(feature = "native-tls",),
6    not(all(
7        any(
8            feature = "no-provider",
9            feature = "default-rustls-provider",
10            feature = "aws-lc-rustls-provider",
11            feature = "ring-rustls-provider",
12        ),
13        any(
14            feature = "default-rustls-verifier",
15            feature = "webpki-rustls-verifier",
16            feature = "platform-rustls-verifier"
17        )
18    ))
19))]
20compile_error!(
21    "When enabling rust-tls features, you must also enable default-rustls-provider and default-rustls-verifier features."
22);
23
24#[cfg(all(feature = "native-tls", feature = "rust-tls"))]
25compile_error!("You cannot enable native-tls and rust-tls features at the same time.");
26
27#[cfg(all(not(any(feature = "native-tls", feature = "rust-tls")), feature = "http2"))]
28compile_error!("HTTP2 requires native-tls or rust-tls support.");
29
30#[cfg(all(feature = "native-tls", feature = "http3"))]
31compile_error!("HTTP3 is not supported within native-tls runtime.");
32
33#[cfg(not(any(feature = "http1", feature = "http2", feature = "http3")))]
34compile_error!("At least one HTTP version feature must be enabled.");
35
36use deboa::InnerClient;
37
38use crate::{
39    cert::{DeboaCertificate, DeboaIdentity},
40    client::{dns::DefaultDnsResolver, http::conn::pool::HttpConnectionPool},
41};
42
43/// Certificate management module for handling SSL/TLS certificates.
44pub mod cert;
45/// Internal module for HTTP and Websockets clients implementations.
46pub mod client;
47/// Internal runtime module for Smol-based HTTP client implementation.
48pub(crate) mod rt;
49
50/// Inner client type with generic resolver.
51pub type RuntimeClient<Resolver> =
52    InnerClient<DeboaIdentity, DeboaCertificate, HttpConnectionPool, Resolver>;
53
54/// Type alias for the Tokio-based HTTP client.
55pub type Client = deboa::Client<RuntimeClient<DefaultDnsResolver>>;
56
57/// Type alias for the custom Tokio-based HTTP client.
58pub type CustomClient<Resolver> = deboa::Client<RuntimeClient<Resolver>>;