Skip to main content

deboa_tokio/
lib.rs

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