Skip to main content

rig_http/
lib.rs

1#![cfg_attr(docsrs, feature(doc_cfg))]
2#![cfg_attr(
3    test,
4    allow(
5        clippy::expect_used,
6        clippy::indexing_slicing,
7        clippy::panic,
8        clippy::unwrap_used,
9        clippy::unreachable
10    )
11)]
12//! Rig's transport contracts. A transport implements
13//! [`HttpClientExt`](http_client::HttpClientExt) (and, for websocket sessions,
14//! [`WebSocketClientExt`](ws_client::WebSocketClientExt)), and every Rig
15//! provider sends through it. This crate holds no transport of its own:
16//! `rig-reqwest` and `rig-tungstenite` are the bundled ones. `rig-core`
17//! re-exports these modules at `rig_core::http_client`, `rig_core::ws_client`
18//! and `rig_core::wasm_compat`.
19//!
20//! ```
21//! use rig_http::http_client::{DynHttpClient, HttpClientExt};
22//!
23//! fn erase(client: impl HttpClientExt + Clone + 'static) -> DynHttpClient {
24//!     DynHttpClient::new(client)
25//! }
26//! ```
27
28pub mod http_client;
29#[cfg(all(feature = "tokio", not(target_family = "wasm")))]
30#[cfg_attr(docsrs, doc(cfg(feature = "tokio")))]
31pub mod runtime;
32#[cfg(any(test, feature = "test-utils"))]
33#[cfg_attr(docsrs, doc(cfg(feature = "test-utils")))]
34pub mod test_utils;
35pub mod wasm_compat;
36#[cfg(feature = "websocket")]
37#[cfg_attr(docsrs, doc(cfg(feature = "websocket")))]
38pub mod ws_client;