Skip to main content

Module rules

Module rules 

Source
Expand description

Rule-checking functions operate on the raw (possibly-absent) string value for a field and return Some(message) on failure. Each rule is independent, matching Laravel’s rule composition: an absent value doesn’t trigger email/length - only required cares about absence.

Every message goes through larust_lang::t_or/larust_lang::t_or_with rather than a bare literal - a validation.*-keyed entry in an app’s own resources/lang/{locale}.json overrides the message below; an app with no such entry (nearly every app, today) still gets the exact English text that’s always been hardcoded here, since t_or’s whole point (unlike larust_lang::t) is falling back to a real default instead of an unresolved, literal key reaching a user.

Functions§

confirmed
Laravel’s confirmed rule: checks a field against a same-named ..._confirmation field (e.g. password / password_confirmation). Unlike the other rules here, an absent confirmation value is itself a failure whenever the primary value is present and non-empty - a present password with no password_confirmation field submitted at all is a mismatch, not something to silently skip.
email
max_length
min_length
required