class
Analyzer::Rust::Rwf
- Analyzer::Rust::Rwf
- Analyzer::Rust::RustEngine
- Analyzer
- Reference
- Object
Overview
RWF analyzer (tree-sitter port). RWF registers routes in a handful of shapes, all handled here:
route!("/path" => Controller) single route; the controller's
Controller impl handle body
enumerates verbs + params.
crud!("/path" => Controller) six RESTful routes (the
rest!("/path" => Controller) RestController/ModelController
convention).
Controller.route("/path") the same three as method calls
Controller::new().rest("/p") (no macro), plus
controller.wildcard("/path") a catch-all mount.
Registrations almost always sit inside Server::new(vec![ ... ]) /
Engine::new(vec![ ... ]). tree-sitter leaves a vec! body as a
flat token_tree with no macro_invocation / call_expression
nodes, so we re-parse each route-bearing macro body as an expression
fragment and scan it too, mapping line numbers back onto the file.
Defined in:
analyzer/analyzers/rust/rwf.crConstant Summary
-
HTTP_METHODS =
["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"] of ::String -
REST_ROUTES =
[{"", "GET"}, {"", "POST"}, {"/:id", "GET"}, {"/:id", "PUT"}, {"/:id", "PATCH"}, {"/:id", "DELETE"}] -
crud!/rest!register the standard REST surface.:idis the resource identifier param RWF uses for the member routes.