Noir::RustRoutesMacro
Route tables declared through a project-local #[routes::routes(...)]
attribute (Meilisearch's actix-web DSL):
#[routes::routes(routes( "" => [get(list), post(create)], "/{uid}/documents" => sub(documents::DocumentsApi), ))] pub struct IndexesApi;
A "path" => verb(handler) entry is a route; "path" => sub(Type) mounts
the table declared on Type under path. No file I/O: extract takes
source text, the analyzer resolves sub across files.
Constants
ATTR_RE = /#\[\s*(?:\w+::)*routes\s*::\s*routes\s*\(/
CALL_RE = /\A(\w+)\s*\(\s*([\w:]+)\s*\)\z/
ENTRY_RE = /\A"([^"]*)"\s*=>\s*(.+)\z/m
KEY_VAR_RE = /(\w+)\s*:\s*\$(\w+)\s*:\s*\w+/
MACRO_RE = /macro_rules!\s+(\w+)/
MAX_ATTR = 20000
MAX_INVOCATION = 500000
MOD_VAR_RE = /\bmod\s+\$(\w+)/
OWNER_RE = /\G\s*\]\s*(?:#\[[^\]]*\]\s*)*(?:pub(?:\([^)]*\))?\s+)?struct\s+(\w+)/
ROUTES_RE = /(?<![\w])routes\s*\(/
RULES = Noir::TopLevelSplit::Rules.new(quotes: "\"")
VERBS = ["get", "post", "put", "patch", "delete", "head", "options"] of ::String