Skip to main content

http_type/
lib.rs

1//! http-type
2//!
3//! A comprehensive Rust library providing essential types for HTTP operations.
4//! Includes core HTTP abstractions (request/response, methods, status codes, versions),
5//! content types, cookies, WebSocket support, and thread-safe
6//! concurrent types (ArcMutex, ArcRwLock). Also provides convenient
7//! Option-wrapped primitive types for flexible HTTP handling.
8
9mod any;
10mod arc_mutex;
11mod arc_rwlock;
12mod attribute;
13mod box_leak;
14mod box_rwlock;
15mod content_type;
16mod cookie;
17mod file_extension;
18mod hash_map_xx_hash3_64;
19mod hash_set_xx_hash3_64;
20mod http_status;
21mod http_url;
22mod http_version;
23mod lifetime;
24mod methods;
25mod panic;
26mod protocol;
27mod rc_rwlock;
28mod request;
29mod response;
30mod status;
31mod stream;
32mod task;
33mod upgrade_type;
34mod websocket_frame;
35
36pub use {
37    any::*, arc_mutex::*, arc_rwlock::*, attribute::*, box_leak::*, box_rwlock::*, content_type::*,
38    cookie::*, file_extension::*, hash_map_xx_hash3_64::*, hash_set_xx_hash3_64::*, http_status::*,
39    http_url::*, http_version::*, lifetime::*, methods::*, panic::*, protocol::*, rc_rwlock::*,
40    request::*, response::*, status::*, stream::*, task::*, upgrade_type::*, websocket_frame::*,
41};
42
43pub use {http_compress::*, http_constant::*, serde_json, tokio};
44
45use std::{
46    any::Any,
47    collections::{HashMap, HashSet, VecDeque},
48    fmt::{self, Debug, Display},
49    hash::Hash,
50    io::ErrorKind,
51    net::IpAddr,
52    num::ParseIntError,
53    pin::Pin,
54    rc::Rc,
55    result::Result,
56    str::{FromStr, SplitWhitespace},
57    sync::{
58        Arc,
59        atomic::{self, AtomicBool, AtomicUsize},
60    },
61    time::Duration,
62};
63
64#[cfg(test)]
65use tokio::{spawn, task::JoinHandle};
66use {
67    core::hash::BuildHasherDefault,
68    lombok_macros::*,
69    serde::{Deserialize, Serialize, de::DeserializeOwned},
70    tokio::{
71        io::{AsyncBufReadExt, AsyncReadExt, AsyncWriteExt, BufReader},
72        net::TcpStream,
73        runtime::Handle,
74        sync::{
75            Mutex, Notify, RwLock, RwLockReadGuard, RwLockWriteGuard,
76            mpsc::{UnboundedReceiver, UnboundedSender, unbounded_channel},
77        },
78        task::{JoinError, LocalSet, spawn_blocking, spawn_local},
79        time::{error::Elapsed, timeout},
80    },
81    url::{ParseError, Url},
82};