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::{HeaderMap, bearer_auth_header};
22//!
23//! let mut headers = HeaderMap::new();
24//! bearer_auth_header(&mut headers, "example-token")?;
25//! # Ok::<(), rig_http::http_client::Error>(())
26//! ```
27
28pub mod http_client;
29#[cfg(any(test, feature = "test-utils"))]
30#[cfg_attr(docsrs, doc(cfg(feature = "test-utils")))]
31pub mod test_utils;
32pub mod wasm_compat;
33#[cfg(feature = "websocket")]
34#[cfg_attr(docsrs, doc(cfg(feature = "websocket")))]
35pub mod ws_client;