Skip to main content

http_type/
lib.rs

1//! http-type
2//!
3//! A comprehensive Rust type library for HTTP operations and concurrent programming.
4//! Provides core HTTP types (Request/Response with builder patterns, Method, HttpStatus, HttpVersion,
5//! ContentType, FileExtension with MIME mapping, Cookie parsing/building, HttpUrl parsing,
6//! WebSocket frame/opcode, protocol upgrade types, stream/task management, panic handling),
7//! thread-safe concurrent wrappers (ArcMutex, ArcRwLock, BoxRwLock, RcRwLock),
8//! dynamic dispatch types (BoxAny, RcAny, ArcAny with Send/Sync variants),
9//! high-performance hash collections (HashMapXxHash3_64, HashSetXxHash3_64),
10//! and static lifetime utilities (BoxLeak, Lifetime trait).
11
12mod any;
13mod arc_mutex;
14mod arc_rwlock;
15mod attribute;
16mod box_leak;
17mod box_rwlock;
18mod content_type;
19mod cookie;
20mod file_extension;
21mod hash_map_xx_hash3_64;
22mod hash_set_xx_hash3_64;
23mod http_status;
24mod http_url;
25mod http_version;
26mod lifetime;
27mod methods;
28mod panic;
29mod protocol;
30mod rc_rwlock;
31mod request;
32mod response;
33mod status;
34mod stream;
35mod task;
36mod upgrade_type;
37mod websocket_frame;
38
39pub use {
40    any::*, arc_mutex::*, arc_rwlock::*, attribute::*, box_leak::*, box_rwlock::*, content_type::*,
41    cookie::*, file_extension::*, hash_map_xx_hash3_64::*, hash_set_xx_hash3_64::*, http_status::*,
42    http_url::*, http_version::*, lifetime::*, methods::*, panic::*, protocol::*, rc_rwlock::*,
43    request::*, response::*, status::*, stream::*, task::*, upgrade_type::*, websocket_frame::*,
44};
45
46pub use {http_compress::*, http_constant::*, serde_json, tokio};
47
48use std::{
49    any::Any,
50    collections::{HashMap, HashSet, VecDeque},
51    fmt::{self, Debug, Display},
52    hash::Hash,
53    io::ErrorKind,
54    net::IpAddr,
55    num::ParseIntError,
56    pin::Pin,
57    rc::Rc,
58    result::Result,
59    str::{FromStr, SplitWhitespace},
60    sync::{
61        Arc,
62        atomic::{self, AtomicBool, AtomicUsize},
63    },
64    time::Duration,
65};
66
67#[cfg(test)]
68use tokio::{spawn, task::JoinHandle};
69use {
70    core::hash::BuildHasherDefault,
71    lombok_macros::*,
72    serde::{Deserialize, Serialize, de::DeserializeOwned},
73    tokio::{
74        io::{AsyncBufReadExt, AsyncReadExt, AsyncWriteExt, BufReader},
75        net::TcpStream,
76        runtime::Handle,
77        sync::{
78            Mutex, Notify, RwLock, RwLockReadGuard, RwLockWriteGuard,
79            mpsc::{UnboundedReceiver, UnboundedSender, unbounded_channel},
80        },
81        task::{JoinError, LocalSet, spawn_blocking, spawn_local},
82        time::{error::Elapsed, timeout},
83    },
84    url::{ParseError, Url},
85};