Skip to main content

Module constraints

Module constraints 

Source
Expand description

Route/param constraints (Rails constraints: { id: /\d+/ }).

Axum’s path matcher has no regex constraints, so constraints are enforced as a check — typically from a #[before_action] that 404s (or 400s) when a path param fails its format. Constraints maps param names to validators.

Structs§

Constraints
A set of param name → validator rules.

Functions§

alpha
Non-empty and all ASCII letters.
alphanumeric
Non-empty and all ASCII letters or digits.
numeric
Non-empty and all ASCII digits.
uuid_like
The canonical 8-4-4-4-12 hex UUID shape.

Type Aliases§

Validator
A path-param validator: returns whether the value satisfies the constraint.