1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//! URL routing and proxy utilities for Reinhardt framework.
//!
//! This crate provides URL routing, pattern matching, and proxy functionality
//! for the Reinhardt web framework. It is a unified interface over the following
//! internal crates:
//!
//! - `reinhardt-routers`: URL routing and pattern matching with middleware support
//! - `reinhardt-routers-macros`: Compile-time URL validation macros
//! - `reinhardt-proxy`: Lazy relationship loading for ORM
//!
//! ## Features
//!
//! ### Route Middleware Support
//!
//! Per-route middleware configuration is now available. You can attach middleware
//! to specific routes or route groups:
//!
//! ```rust,ignore
//! # use reinhardt_urls::routers::UnifiedRouter;
//! # use hyper::Method;
//! # use reinhardt_http::{Request, Response};
//! # use reinhardt_core::exception::Result;
//!
//! # async fn handler(_req: Request) -> Result<Response> { Ok(Response::ok()) }
//! # async fn users_handler(_req: Request) -> Result<Response> { Ok(Response::ok()) }
//! # async fn settings_handler(_req: Request) -> Result<Response> { Ok(Response::ok()) }
//! let router = UnifiedRouter::new()
//! .function("/public", Method::GET, handler)
//! .function("/protected", Method::GET, handler);
//! // .with_route_middleware(...) // Route-specific middleware
//! ```
//!
//! **Features**:
//! - Per-route middleware configuration
//! - Route group middleware with inheritance
//! - Middleware composition and chaining
//! - Proper execution order: global → group → route → handler
//!
//! See `reinhardt-routers` crate documentation for detailed usage and examples.
pub use reinhardt_routers_macros as routers_macros;
// Re-export the `inventory` crate on the WASM target so the facade can
// expose `reinhardt::inventory` to the `#[routes]` macro's WASM emission
// (parallel to the native `reinhardt::inventory` re-export). The macro
// submits a `ClientRouterRegistration` via `inventory::submit!`, and the
// macro-emitted path is resolved in the consumer crate's namespace, which
// only sees the facade re-export. Refs #4453.
pub use inventory;
// Re-export commonly used types from routers (server-only)
/// Commonly used types re-exported for convenience.
///
/// ## Feature-Gated Items
///
/// Most items in this prelude are available with the default `routers` feature.
/// Some items require additional features to be enabled:
///
/// - `UnifiedRouter` — available on non-WASM targets with the `routers` feature.
/// When targeting WASM, the `client-router` feature must also be enabled.
/// To enable in `Cargo.toml`:
///
/// ```toml
/// [dependencies]
/// reinhardt-urls = { version = "...", features = ["client-router"] }
/// ```
///
/// Or use the `full` feature to enable all functionality:
///
/// ```toml
/// [dependencies]
/// reinhardt-urls = { version = "...", features = ["full"] }
/// ```