class
Analyzer::Rust::Salvo
- Analyzer::Rust::Salvo
- Analyzer::Rust::RustEngine
- Analyzer
- Reference
- Object
Overview
Salvo analyzer (tree-sitter port). Salvo wires routes in two shapes, both handled here:
-
Router-chain DSL: Router::with_path("users/
").get(get_user) Router::new().path("users").hoop(auth).get(list).post(create) Each .<verb>(handler)is paired with the nearest enclosing.with_path(...)/.path(...)found by walking up its receiver chain — so middleware (.hoop(...)) and verb chaining (.get(a).post(b)) between the path and the verb don't break detection. -
Attribute macro: #[endpoint(method = Post, path = "/api/submit/
")] async fn submit_form(...) { ... }
Router chains are frequently assembled inside a vec![ ... ] macro
(impl Routers { fn build() -> Vec<Router> { vec![Router::new()…] } }).
tree-sitter leaves a macro body as a flat token_tree with no
call_expression nodes, so those routes are invisible to a plain
AST walk. We recover them by re-parsing each router-bearing macro
body as an expression fragment and mapping line numbers back.
Defined in:
analyzer/analyzers/rust/salvo.crConstant Summary
-
HTTP_VERBS =
Set {"get", "post", "put", "delete", "patch", "head", "options"} -
ROUTER_METHODS =
Set {"push", "unshift", "path", "with_path", "hoop", "then", "get", "post", "put", "delete", "patch", "head", "options"} -
A call worth treating as a router-chain top: a
.push/.path/ .with_path/.<verb>/.hoop(...)method call or aRouter::*base.