avx_http/
lib.rs

1//! # avx-http - AVL Platform HTTP Client/Server
2//!
3//! Native HTTP library optimized for Brazilian infrastructure and AVL Platform services.
4//!
5//! ## Features
6//!
7//! - **High Performance**: < 500µs request overhead, 100k+ req/s
8//! - **Brazilian Optimized**: Regional routing, smart retries
9//! - **AVL Platform Native**: Built-in auth, telemetry, AvilaDB integration
10//! - **Developer Friendly**: Simple async/await API
11//!
12//! ## Quick Start
13//!
14//! ### Client
15//!
16//! ```rust,no_run
17//! use avx_http::Client;
18//!
19//! #[tokio::main]
20//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
21//!     let client = Client::builder()
22//!         .build()?;
23//!
24//!     let response = client
25//!         .get("https://api.avila.cloud/data")
26//!         .send()
27//!         .await?;
28//!
29//!     println!("Status: {}", response.status());
30//!     Ok(())
31//! }
32//! ```
33//!
34//! ### Server
35//!
36//! ```rust,no_run
37//! use avx_http::{Server, Router, Response};
38//!
39//! #[tokio::main]
40//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
41//!     let router = Router::new()
42//!         .get("/", || async { Response::text("Hello!") });
43//!
44//!     Server::bind("0.0.0.0:3000")
45//!         .router(router)
46//!         .run()
47//!         .await?;
48//!
49//!     Ok(())
50//! }
51//! ```
52
53#![warn(missing_docs)]
54#![warn(clippy::all)]
55
56pub mod error;
57
58#[cfg(feature = "client")]
59pub mod client;
60
61#[cfg(feature = "server")]
62pub mod server;
63
64mod common;
65
66// Re-exports
67pub use error::{Error, Result};
68
69#[cfg(feature = "client")]
70pub use client::{Client, ClientBuilder, Request, Response as ClientResponse};
71
72#[cfg(feature = "server")]
73pub use server::{Server, Router, Response as ServerResponse};
74
75pub use http::{Method, StatusCode, HeaderMap, HeaderValue, Uri};
76
77/// Library version
78pub const VERSION: &str = env!("CARGO_PKG_VERSION");
79
80#[cfg(test)]
81mod tests {
82    use super::*;
83
84    #[test]
85    fn test_version() {
86        assert!(!VERSION.is_empty());
87        assert!(VERSION.starts_with("0."));
88    }
89}