class

Analyzer::Rust::Leptos

Inherits Analyzer::Rust::RustEngine < FileScanEngine < Analyzer < FileHelper < Reference < Object

Leptos #[server] functions. The server_fn macro mounts each one at {prefix}/{endpoint}: prefix defaults to /api and endpoint to the function name. With no explicit endpoint the macro also appends an xxhash of CARGO_MANIFEST_DIR and the module path — that depends on the directory the binary was built in, so it is left off and the URL carries the stable part only.

Arguments come in two spellings: the legacy positional #[server(StructName, "/prefix", "Encoding", "endpoint")] and the keyed #[server(prefix = "/p", endpoint = "e", input = GetUrl)]. The input (or legacy encoding, or protocol) codec decides the method; every function argument is a field of the request.

Constants

ARG_RULES = Noir::TopLevelSplit::Rules.new(nest: ((Noir::TopLevelSplit::Nest::Paren | Noir::TopLevelSplit::Nest::Bracket) | Noir::TopLevelSplit::Nest::Brace) | Noir::TopLevelSplit::Nest::Angle, quotes: "\"")
CODEC_VERB_RE = /\b(get|delete|patch|put|websocket)/i

server_fn lowercases a legacy encoding before matching it ("getjson").

EXTRACTOR_ARG_RE = /\A\w+\s*:(?!:)/

Dioxus name: Type server-side extractors, not URL configuration.

POSITIONAL_KEYS = {"name", "prefix", "encoding", "endpoint"}
SERVER_ATTR_RE = /#\s*\[\s*(?:\w+\s*::\s*)*server\b/

Class methods

tech_name
Source

Instance methods

analyze_file(path : String) : Array(Endpoint)
Source
tech

Instance-side view of the same declaration. The per-file rescues live on this base class, which has no way to name the analyzer that is running inside them, so a skipped file could not be attributed to a tech. Deriving it from analyzer_for keeps the name written exactly once.

Source