router!() { /* proc-macro */ }Expand description
Auto-discovery router macro with optional module path filtering.
Discovers all #[rorpc]-annotated handlers via the inventory crate and
builds an Axum Router. Accepts an optional state expression and/or a
module path pattern to restrict which handlers are included.
§Syntax
router!() // all handlers, no state
router!(state) // all handlers, with state
router!("pattern") // filtered, no state
router!("pattern", state) // filtered + state (any order)
router!(state, "pattern") // filtered + state (any order)
router!(["pat1", "pat2"]) // multiple patterns
router!("prefix::{a,b}") // brace expansion
router!("prefix::*") // wildcard§Pattern matching
Patterns match against the handler’s module_path!() value:
"handlers::planet"— exact module or any child"handlers::*"— all direct and nested children ofhandlers::"handlers::{planet,user}"— brace expansion["handlers::planet", "api::v1"]— explicit list