http_kit/
lib.rs

1#![deny(unsafe_code)]
2#![no_std]
3#![warn(missing_docs, missing_debug_implementations)]
4//! A flexible and ergonomic HTTP toolkit for Rust.
5//!
6//! This crate provides high-level abstractions for HTTP operations while maintaining
7//! performance and type safety. It's designed to be no-std compatible with optional
8//! standard library features.
9//!
10//! # Features
11//!
12//! - **Type-safe HTTP primitives** - Request, Response, Headers, and Body types with strong type checking
13//! - **Streaming support** - Efficient handling of large payloads through streaming interfaces
14//! - **Body transformations** - Convert between different body formats (JSON, form data, files) with zero-copy when possible
15//! - **Middleware system** - Extensible middleware architecture for request/response processing
16//! - **Async/await ready** - Built on top of `futures-lite` for async I/O operations
17//!
18//! # Optional Features
19//!
20//! - `json` - JSON serialization/deserialization via serde_json (enabled by default)
21//! - `form` - Form data handling via serde_urlencoded (enabled by default)
22//! - `fs` - File upload support with MIME type detection
23//! - `mime` - MIME type parsing and manipulation
24//! - `http_body` - Implementation of http_body traits
25//! - `std` - Enable standard library support (enabled by default)
26extern crate alloc;
27
28#[macro_use]
29mod macros;
30
31pub mod sse;
32
33pub mod error;
34pub use error::{BoxHttpError, Error, HttpError, Result, ResultExt};
35mod body;
36
37pub use body::Body;
38pub use body::Error as BodyError;
39
40pub mod middleware;
41#[doc(inline)]
42pub use middleware::Middleware;
43
44pub mod endpoint;
45#[doc(inline)]
46pub use endpoint::Endpoint;
47
48pub mod utils;
49/// A type alias for HTTP requests with a custom `Body` type.
50pub type Request = http::Request<Body>;
51/// A type alias for HTTP responses with a custom `Body` type.
52pub type Response = http::Response<Body>;
53
54#[cfg(feature = "cookie")]
55pub use cookie;
56
57#[cfg(feature = "ws")]
58pub mod ws;
59
60pub use http::{header, method, uri, version, Extensions, Method, StatusCode, Uri, Version};