ignitia/lib.rs
1//! # Ignitia - A Blazing Fast Rust Web Framework π₯
2//!
3//! **Ignitia** is a high-performance, production-ready web framework for Rust that ignites your web development
4//! experience with exceptional speed, memory safety, and developer ergonomics. Built on modern async Rust with
5//! Tokio and Hyper, Ignitia provides a complete toolkit for building scalable web applications, APIs, and real-time
6//! services with full HTTP/1.1, HTTP/2, HTTPS, and WebSocket support.
7//!
8//! ## π₯ Key Features
9//!
10//! ### Multi-Protocol Excellence
11//!
12//! - **HTTP/1.1 & HTTP/2**: Full support with automatic protocol negotiation via ALPN
13//! - **HTTPS/TLS**: Production-ready TLS with certificate management and modern cipher suites
14//! - **WebSocket**: Native WebSocket protocol with connection management and message routing
15//! - **H2C Support**: HTTP/2 over cleartext connections for development and internal services
16//!
17//! ### Performance Optimized
18//!
19//! - **155K+ RPS Capable**: Optimized for extreme throughput with zero-cost abstractions
20//! - **Sub-millisecond Latency**: Fast request processing with efficient routing and middleware
21//! - **Connection Pooling**: Advanced connection management and resource optimization
22//! - **Memory Efficient**: Smart buffer management and minimal heap allocations
23//! - **Radix Tree Routing**: O(k) route lookup complexity where k is path length
24//! - **Lock-Free Reads**: Atomic router swapping for zero-downtime updates
25//!
26//! ### Developer Experience
27//!
28//! - **Type-Safe Routing**: Compile-time route validation with automatic parameter extraction
29//! - **Rich Extractors**: JSON, forms, headers, cookies, query params, and custom extractors
30//! - **Composable Middleware**: Flexible middleware pipeline for cross-cutting concerns
31//! - **Comprehensive Error Handling**: Structured error types with detailed diagnostics
32//! - **Hot Reloading**: Runtime route updates without connection drops
33//!
34//! ### Production Features
35//!
36//! - **Advanced CORS**: Regex-based origin matching with fine-grained control
37//! - **Security Headers**: Built-in security middleware with configurable policies
38//! - **Rate Limiting**: Token bucket algorithm with distributed support
39//! - **Observability**: Structured logging, metrics, and request tracing
40//! - **Multipart Forms**: File upload support with streaming and size limits
41//! - **WebSocket Rooms**: Built-in room system for broadcast messaging
42//!
43//! ## π Quick Start Guide
44//!
45//! Add Ignitia to your `Cargo.toml` with desired features:
46//!
47//! ```
48//! [dependencies]
49//! ignitia = { version = "0.2.4", features = ["tls", "websocket"] }
50//! tokio = { version = "1.40", features = ["full"] }
51//! serde = { version = "1.0", features = ["derive"] }
52//! ```
53//!
54//! ### Simple HTTP Server
55//!
56//! ```
57//! use ignitia::prelude::*;
58//!
59//! #[tokio::main]
60//! async fn main() -> Result<()> {
61//! let router = Router::new()
62//! .get("/", || async {
63//! Ok(Response::text("Hello, Ignitia! π₯"))
64//! })
65//! .get("/health", || async {
66//! Ok(Response::json(serde_json::json!({"status": "healthy"}))?)
67//! })
68//! .post("/echo", |body: String| async move {
69//! Ok(Response::text(format!("Echo: {}", body)))
70//! });
71//!
72//! let addr = "127.0.0.1:8080".parse()?;
73//! Server::new(router, addr).ignitia().await
74//! }
75//! ```
76//!
77//! ### Advanced HTTP/2 Configuration
78//!
79//! ```
80//! use ignitia::{Router, Server, ServerConfig, Http2Config};
81//! use std::time::Duration;
82//!
83//! #[tokio::main]
84//! async fn main() -> ignitia::Result<()> {
85//! let router = Router::new()
86//! .get("/", || async { Ok(ignitia::Response::text("HTTP/2 Ready! π")) });
87//!
88//! // Configure HTTP/2 with optimizations
89//! let config = ServerConfig {
90//! http1_enabled: true,
91//! http2: Http2Config {
92//! enabled: true,
93//! enable_prior_knowledge: true, // H2C support
94//! max_concurrent_streams: Some(1000),
95//! initial_connection_window_size: Some(1024 * 1024), // 1MB
96//! keep_alive_interval: Some(Duration::from_secs(60)),
97//! adaptive_window: true,
98//! ..Default::default()
99//! },
100//! auto_protocol_detection: true,
101//! max_request_body_size: 16 * 1024 * 1024, // 16MB
102//! ..Default::default()
103//! };
104//!
105//! let addr = "127.0.0.1:8080".parse()?;
106//! Server::with_config(router, addr, config).ignitia().await
107//! }
108//! ```
109//!
110//! ## π HTTPS and TLS Support
111//!
112//! Ignitia provides comprehensive TLS support with modern security standards:
113//!
114//! ### Basic HTTPS Setup
115//!
116//! ```
117//! use ignitia::prelude::*;
118//!
119//! #[tokio::main]
120//! async fn main() -> Result<()> {
121//! let router = Router::new()
122//! .get("/", || async { Ok(Response::text("Secure Hello! π")) });
123//!
124//! let addr = "127.0.0.1:8443".parse()?;
125//! Server::new(router, addr)
126//! .enable_https("server.crt", "server.key")?
127//! .ignitia()
128//! .await
129//! }
130//! ```
131//!
132//! ### Advanced TLS Configuration
133//!
134//! ```
135//! #[cfg(feature = "tls")]
136//! use ignitia::{TlsConfig, TlsVersion};
137//!
138//! #[cfg(feature = "tls")]
139//! let tls_config = TlsConfig::new("cert.pem", "key.pem")
140//! .with_alpn_protocols(vec!["h2", "http/1.1"]) // HTTP/2 priority
141//! .with_protocol_versions(&[TlsVersion::TlsV12, TlsVersion::TlsV13])
142//! .with_cipher_suites(&["TLS_AES_256_GCM_SHA384", "TLS_CHACHA20_POLY1305_SHA256"])
143//! .enable_client_cert_verification();
144//!
145//! #[cfg(feature = "tls")]
146//! Server::new(router, addr)
147//! .with_tls(tls_config)?
148//! .ignitia()
149//! .await
150//! ```
151//!
152//! ## π Advanced CORS Configuration
153//!
154//! Comprehensive CORS support for secure cross-origin requests:
155//!
156//! ### Production CORS Setup
157//!
158//! ```
159//! use ignitia::{CorsMiddleware, Method, Router, Response};
160//!
161//! # async fn example() -> ignitia::Result<()> {
162//! let cors = CorsMiddleware::new()
163//! .allowed_origins(&["https://myapp.com", "https://admin.myapp.com"])
164//! .allowed_methods(&[Method::GET, Method::POST, Method::PUT, Method::DELETE])
165//! .allowed_headers(&["Content-Type", "Authorization", "X-API-Key"])
166//! .expose_headers(&["X-Total-Count", "X-Rate-Limit-Remaining"])
167//! .allow_credentials()
168//! .max_age(86400) // 24 hours
169//! .build()?;
170//!
171//! let router = Router::new()
172//! .middleware(cors)
173//! .get("/api/users", || async { Ok(Response::json(vec!["user1", "user2"])?) });
174//! # Ok(())
175//! # }
176//! ```
177//!
178//! ### Regex-Based Origin Matching
179//!
180//! ```
181//! use ignitia::CorsMiddleware;
182//!
183//! # fn example() -> ignitia::Result<()> {
184//! let cors = CorsMiddleware::new()
185//! .allowed_origin_regex(r"https://.*\.myapp\.com") // All subdomains
186//! .allowed_origin_regex(r"https://localhost:\d+") // Local development ports
187//! .build()?;
188//! # Ok(())
189//! # }
190//! ```
191//!
192//! ## π‘ WebSocket Support
193//!
194//! Full-featured WebSocket implementation with HTTP/2 compatibility:
195//!
196//! ### Advanced WebSocket Server
197//!
198//! ```
199//! #[cfg(feature = "websocket")]
200//! use ignitia::websocket::{websocket_handler, Message, WebSocketConnection};
201//! use std::sync::Arc;
202//! use tokio::sync::Mutex;
203//! use std::collections::HashMap;
204//!
205//! #[cfg(feature = "websocket")]
206//! type ClientMap = Arc<Mutex<HashMap<String, WebSocketConnection>>>;
207//!
208//! #[cfg(feature = "websocket")]
209//! let clients: ClientMap = Arc::new(Mutex::new(HashMap::new()));
210//!
211//! #[cfg(feature = "websocket")]
212//! let router = Router::new()
213//! // Simple echo WebSocket
214//! .websocket("/ws/echo", websocket_handler(|mut ws: WebSocketConnection| async move {
215//! while let Some(message) = ws.recv().await {
216//! match message {
217//! Message::Text(text) => {
218//! ws.send_text(format!("Echo: {}", text)).await?;
219//! }
220//! Message::Binary(data) => {
221//! ws.send_bytes(data).await?;
222//! }
223//! Message::Ping(data) => {
224//! ws.send_pong(data).await?;
225//! }
226//! Message::Close(_) => break,
227//! _ => {}
228//! }
229//! }
230//! Ok(())
231//! }));
232//! ```
233//!
234//! ## ποΈ Framework Architecture
235//!
236//! Ignitia's layered architecture supports multiple protocols and advanced features:
237//!
238//! ```
239//! βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
240//! β Application Layer β
241//! β βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββββββββββββββ β
242//! β β Routes β β Middleware β β CORS β β WebSocket β β
243//! β β & Handlers β β Pipeline β βConfigurationβ β Handlers β β
244//! β βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββββββββββββββ β
245//! βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
246//! β Ignitia Framework β
247//! β βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββββββββββββββ β
248//! β β Router β β Server β β TLS β β WebSocket β β
249//! β β Radix Tree β β HTTP/1.1+2 β β ALPN & Cert β β Connection Management β β
250//! β βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββββββββββββββ β
251//! βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
252//! β Runtime Layer (Tokio) β
253//! β βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββββββββββββββ β
254//! β β HTTP β β TLS β β TCP β β Async I/O β β
255//! β β (Hyper) β β (Rustls) β β Listeners β β & Futures β β
256//! β βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββββββββββββββ β
257//! βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
258//! ```
259//!
260//! ## π§ Feature Configuration
261//!
262//! Ignitia uses Cargo features for optional functionality:
263//!
264//! ### Available Features
265//!
266//! - **`tls`**: Enables HTTPS/TLS support with certificate management and ALPN protocol negotiation
267//! - **`websocket`**: Enables WebSocket protocol support with connection management and message routing
268//! - **`self-signed`**: Enables self-signed certificate generation for development environments
269//! - **`default`**: No additional features (HTTP/1.1 and HTTP/2 over cleartext only)
270//!
271//! ## π― Performance Benchmarks
272//!
273//! Ignitia is optimized for exceptional performance:
274//!
275//! ### Throughput (Requests/Second)
276//!
277//! - **Simple JSON API**: 155,000+ RPS (Radix mode)
278//! - **Static file serving**: 140,000+ RPS
279//! - **WebSocket connections**: 25,000+ concurrent
280//! - **HTTPS with TLS 1.3**: 110,000+ RPS
281//!
282//! ### Latency (99th percentile)
283//!
284//! - **HTTP/1.1**: < 0.8ms
285//! - **HTTP/2**: < 1.0ms
286//! - **HTTPS**: < 1.3ms
287//! - **WebSocket message**: < 0.5ms
288//!
289//! ### Resource Usage
290//!
291//! - **Memory per connection**: ~2KB
292//! - **CPU overhead**: < 3% at 100K RPS
293//! - **Binary size**: ~4MB (with all features)
294//!
295//! ## π Core Concepts
296//!
297//! ### Request/Response Lifecycle
298//!
299//! ```
300//! βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
301//! β Ignitia Request Pipeline β
302//! βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
303//!
304//! 1. Connection Accept (TCP/TLS)
305//! ββ Protocol Detection (HTTP/1.1, HTTP/2, WebSocket)
306//! ββ TLS Handshake (if HTTPS)
307//! ββ Connection Pooling
308//!
309//! 2. Request Parsing
310//! ββ Header Parsing and Validation
311//! ββ Body Streaming (with size limits)
312//! ββ Protocol-specific Processing
313//!
314//! 3. Middleware Pipeline (Request Phase)
315//! ββ CORS Preflight Handling
316//! ββ Authentication/Authorization
317//! ββ Rate Limiting
318//! ββ Request ID Generation
319//! ββ Custom middleware
320//!
321//! 4. Route Resolution
322//! ββ Path Matching (radix tree O(k) lookup)
323//! ββ Parameter Extraction
324//! ββ Handler Selection
325//! ββ WebSocket Upgrade Detection
326//!
327//! 5. Handler Execution
328//! ββ Extractor Processing
329//! ββ Business Logic
330//! ββ Response Generation
331//!
332//! 6. Middleware Pipeline (Response Phase)
333//! ββ Error Handling
334//! ββ Response Headers (Security, CORS)
335//! ββ Compression
336//! ββ Logging
337//!
338//! 7. Response Transmission
339//! ββ Protocol-specific Formatting
340//! ββ Connection Management
341//! ββ Metrics Collection
342//! ```
343//!
344//! ### Routing Modes
345//!
346//! Ignitia supports two routing modes optimized for different use cases:
347//!
348//! #### Radix Mode (Default - Recommended)
349//!
350//! - **Performance**: O(k) lookup where k is path length
351//! - **Best for**: Applications with 50+ routes
352//! - **Features**: Compressed prefix tree, efficient parameter extraction
353//! - **Memory**: Optimized for large route sets
354//!
355//! #### Base Mode
356//!
357//! - **Performance**: O(n) linear matching where n is route count
358//! - **Best for**: Applications with < 50 routes
359//! - **Features**: Simple regex-based matching
360//! - **Memory**: Lower overhead for small apps
361//!
362//! ## π Module Documentation
363//!
364//! ### Core Modules
365//!
366//! - [`cookie`]: HTTP cookie handling with secure defaults and session management
367//! - [`error`]: Comprehensive error handling with structured error types and custom responses
368//! - [`extension`]: Type-safe request/response extensions for sharing data between middleware
369//! - [`handler`]: Request handlers, extractors, and handler trait implementations
370//! - [`middleware`]: Middleware system including CORS, authentication, logging, and security
371//! - [`multipart`]: Multipart form data parsing with file upload support
372//! - [`request`]: HTTP request representation with efficient parsing and validation
373//! - [`response`]: HTTP response building with content negotiation and streaming
374//! - [`router`]: High-performance route matching with parameter extraction and middleware composition
375//! - [`server`]: Multi-protocol server with HTTP/1.1, HTTP/2, TLS, and WebSocket support
376//! - [`utils`]: Utility functions for common web development tasks
377//!
378//! ### Feature-Gated Modules
379//!
380//! - [`websocket`]: WebSocket protocol support with connection management (requires `websocket` feature)
381//!
382//! ## π€ Contributing
383//!
384//! We welcome contributions! Please see our [Contributing Guidelines](https://github.com/AarambhDevHub/ignitia/blob/main/CONTRIBUTING.md)
385//! for information on:
386//!
387//! - Setting up the development environment
388//! - Running tests and benchmarks
389//! - Code style and documentation standards
390//! - Submitting pull requests
391//! - Reporting issues and feature requests
392//!
393//! ## π License
394//!
395//! This project is licensed under the MIT License - see the [LICENSE](https://github.com/AarambhDevHub/ignitia/blob/main/LICENSE)
396//! file for details.
397//!
398//! ## π Resources
399//!
400//! - **Repository**: <https://github.com/AarambhDevHub/ignitia>
401//! - **Documentation**: <https://docs.rs/ignitia>
402//! - **Examples**: <https://github.com/AarambhDevHub/ignitia/tree/main/examples>
403//! - **Changelog**: <https://github.com/AarambhDevHub/ignitia/blob/main/doc/CHANGELOG.md>
404//! - **Crates.io**: <https://crates.io/crates/ignitia>
405
406// Enable documentation features for docs.rs
407#![cfg_attr(docsrs, feature(doc_cfg))]
408// Deny missing docs to ensure comprehensive documentation
409#![warn(missing_docs)]
410// Enable additional documentation lint rules
411#![warn(rustdoc::missing_crate_level_docs)]
412
413#[cfg(not(target_env = "msvc"))]
414use mimalloc::MiMalloc;
415
416#[cfg(not(target_env = "msvc"))]
417#[global_allocator]
418static GLOBAL: MiMalloc = MiMalloc;
419
420// Core framework modules
421pub mod cookie;
422pub mod error;
423pub mod extension;
424pub mod handler;
425pub mod middleware;
426pub mod multipart;
427pub mod request;
428pub mod response;
429pub mod router;
430pub mod server;
431pub mod utils;
432
433// WebSocket support (feature-gated)
434#[cfg(feature = "websocket")]
435#[cfg_attr(docsrs, doc(cfg(feature = "websocket")))]
436pub mod websocket;
437
438// Re-export cookie types for easy access
439pub use cookie::{Cookie, CookieJar, SameSite};
440
441// Re-export error types and utilities
442pub use error::{
443 CustomError, Error, ErrorExt, ErrorHandler, ErrorHandlerType, ErrorHandlerWithRequest,
444 ErrorResponse, Result,
445};
446
447// Re-export extension system
448pub use extension::{Extension, Extensions};
449
450// Re-export handler extractors with aliases to avoid naming conflicts
451pub use handler::extractor::{
452 Body, Cookies, Form, Headers, Json, Method as IgnitiaMethod, Path, Query, State, Uri,
453};
454
455// Re-export handler types and utilities
456pub use handler::{
457 handler_fn, into_handler, raw_handler, Handler, HandlerFn, IntoHandler, RawRequest,
458};
459
460// Re-export middleware types
461pub use middleware::{
462 BodySizeLimitBuilder, BodySizeLimitMiddleware, CompressionMiddleware, CorsMiddleware,
463 IdGenerator, LoggerMiddleware, Middleware, Next, RateLimitConfig, RateLimitInfo,
464 RateLimitStats, RateLimitingMiddleware, RequestIdMiddleware, SecurityMiddleware,
465};
466
467// Re-export core request and response types
468pub use request::Request;
469pub use response::{CacheControl, Html, IntoResponse, Response, ResponseBuilder};
470
471// Re-export routing components
472pub use router::{LayeredHandler, Route, Router};
473
474// Re-export server components
475pub use server::{Http2Config, PerformanceConfig, PoolConfig, Server, ServerConfig};
476
477// Re-export multipart components
478pub use multipart::{Field, FileField, Multipart, MultipartConfig, MultipartError, TextField};
479
480#[cfg(feature = "tls")]
481#[cfg_attr(docsrs, doc(cfg(feature = "tls")))]
482pub use server::tls::{TlsConfig, TlsError, TlsVersion};
483
484// Re-export WebSocket functionality when feature is enabled
485#[cfg(feature = "websocket")]
486#[cfg_attr(docsrs, doc(cfg(feature = "websocket")))]
487pub use websocket::{
488 handle_websocket_upgrade, is_websocket_request, upgrade_connection, websocket_batch_handler,
489 websocket_handler, websocket_message_handler, BatchMessageHandler, CloseFrame, Message,
490 MessageType, OptimizedMessageHandler, WebSocketConnection, WebSocketHandler,
491};
492
493// Re-export commonly used external types for convenience
494/// Async trait support for defining async traits
495pub use async_trait::async_trait;
496
497/// HTTP types from the `http` crate
498pub use http::{HeaderMap, HeaderValue, Method, StatusCode};
499
500// Version information
501/// The current version of the Ignitia framework
502pub const VERSION: &str = env!("CARGO_PKG_VERSION");
503
504/// The name of the Ignitia framework
505pub const NAME: &str = env!("CARGO_PKG_NAME");
506
507/// Framework information and build details
508pub mod info {
509 //! Framework information and build metadata.
510 //!
511 //! This module provides utilities for accessing framework version information,
512 //! enabled features, and build metadata. Useful for debugging, monitoring,
513 //! and feature detection in applications.
514
515 /// Returns the framework name and version as a formatted string
516 ///
517 /// # Examples
518 ///
519 /// ```
520 /// use ignitia::info;
521 ///
522 /// println!("Running {}", info::version());
523 /// // Output: "Running ignitia v0.2.4"
524 /// ```
525 pub fn version() -> String {
526 format!("{} v{}", crate::NAME, crate::VERSION)
527 }
528
529 /// Returns comprehensive build information
530 ///
531 /// # Examples
532 ///
533 /// ```
534 /// use ignitia::info;
535 ///
536 /// let build = info::build_info();
537 /// println!("Framework: {} v{}", build.name, build.version);
538 /// println!("Features: {:?}", build.features);
539 /// ```
540 pub fn build_info() -> BuildInfo {
541 BuildInfo {
542 name: crate::NAME,
543 version: crate::VERSION,
544 features: get_enabled_features(),
545 }
546 }
547
548 /// Build information structure
549 ///
550 /// Contains metadata about the current Ignitia build including
551 /// enabled features and version information.
552 #[derive(Debug, Clone)]
553 pub struct BuildInfo {
554 /// Framework name
555 pub name: &'static str,
556 /// Framework version
557 pub version: &'static str,
558 /// Enabled features
559 pub features: Vec<&'static str>,
560 }
561
562 /// Get list of enabled features
563 ///
564 /// Returns a vector of feature names that were enabled during compilation.
565 /// Useful for runtime feature detection and conditional behavior.
566 fn get_enabled_features() -> Vec<&'static str> {
567 let mut features = Vec::new();
568
569 #[cfg(feature = "tls")]
570 features.push("tls");
571
572 #[cfg(feature = "websocket")]
573 features.push("websocket");
574
575 #[cfg(feature = "self-signed")]
576 features.push("self-signed");
577
578 if features.is_empty() {
579 features.push("default");
580 }
581
582 features
583 }
584}
585
586/// Prelude module for convenient imports
587///
588/// This module re-exports the most commonly used types and traits from Ignitia,
589/// allowing applications to import everything needed with a single use statement.
590///
591/// # Usage
592///
593/// ```
594/// use ignitia::prelude::*;
595///
596/// // Now you have access to Router, Server, Response, etc.
597/// let router = Router::new();
598/// let response = Response::text("Hello, World!");
599/// ```
600///
601/// # Included Types
602///
603/// - **Core Types**: `Router`, `Server`, `Request`, `Response`, `Result`, `Error`
604/// - **Configuration**: `ServerConfig`, `Http2Config`, `PerformanceConfig`
605/// - **TLS Support**: `TlsConfig`, `TlsError`, `TlsVersion` (when `tls` feature is enabled)
606/// - **Handlers**: `Handler`, `HandlerFn`, `IntoHandler`
607/// - **Middleware**: `Middleware`, `CorsMiddleware`, `LoggerMiddleware`, `AuthMiddleware`
608/// - **Extractors**: `Path`, `Query`, `Json`, `Headers`, `Body`, `Cookies`, `Uri`
609/// - **HTTP Types**: `Method`, `StatusCode`, `HeaderMap`, `HeaderValue`
610/// - **WebSocket**: `WebSocketConnection`, `Message`, `WebSocketHandler` (when `websocket` feature is enabled)
611/// - **Utilities**: `async_trait` for defining async traits
612pub mod prelude {
613 //! Common imports for Ignitia applications.
614 //!
615 //! This prelude module provides convenient access to the most commonly used
616 //! types and traits in Ignitia applications. It's designed to reduce boilerplate
617 //! and provide a smooth development experience.
618 //!
619 //! # Examples
620 //!
621 //! ```
622 //! use ignitia::prelude::*;
623 //!
624 //! #[tokio::main]
625 //! async fn main() -> Result<()> {
626 //! let router = Router::new()
627 //! .get("/", || async { Ok(Response::text("Hello!")) });
628 //!
629 //! Server::new(router, "127.0.0.1:8080".parse()?)
630 //! .ignitia()
631 //! .await
632 //! }
633 //! ```
634
635 // Core framework types
636 pub use crate::{Error, Request, Response, Result, Router, Server};
637
638 // Server and performance configuration
639 pub use crate::{Http2Config, PerformanceConfig, PoolConfig, ServerConfig};
640
641 // TLS support (when enabled)
642 #[cfg(feature = "tls")]
643 #[cfg_attr(docsrs, doc(cfg(feature = "tls")))]
644 pub use crate::{TlsConfig, TlsError, TlsVersion};
645
646 // Handler and middleware types
647 pub use crate::{Handler, HandlerFn, IntoHandler, Middleware, Next};
648
649 // Essential middleware implementations
650 pub use crate::{CorsMiddleware, LoggerMiddleware, RateLimitingMiddleware, SecurityMiddleware};
651
652 // Request extractors
653 pub use crate::{Body, Cookies, Form, Headers, Json, Path, Query, State, Uri};
654
655 // HTTP types from the http crate
656 pub use crate::{HeaderMap, HeaderValue, Method, StatusCode};
657
658 // Extension system
659 pub use crate::{Extension, Extensions};
660
661 // Cookie support
662 pub use crate::{Cookie, CookieJar, SameSite};
663
664 // Multipart support
665 pub use crate::{Field, FileField, Multipart, MultipartConfig, TextField};
666
667 // Async trait support
668 pub use crate::async_trait;
669
670 // WebSocket types (when feature is enabled)
671 #[cfg(feature = "websocket")]
672 #[cfg_attr(docsrs, doc(cfg(feature = "websocket")))]
673 pub use crate::{
674 websocket_handler, BatchMessageHandler, CloseFrame, Message, MessageType,
675 WebSocketConnection, WebSocketHandler,
676 };
677
678 // Framework information
679 pub use crate::{info, NAME, VERSION};
680}