pub enum Rule {
}Expand description
Field validation rule.
Variants§
Required
Unique
MinLen(usize)
MaxLen(usize)
Min(i64)
Max(i64)
Scale(u8)
Most decimals of a Decimal field (#[rule(scale = 4)]); 2 without the rule.
Precision(u8)
Most digits of a Decimal field, decimals included (#[rule(precision = 12)]); 18
without the rule. With the scale it gives the column type, NUMERIC(12, 4).
Mask(&'static str)
The raw value fills a pattern (#[rule(mask = "(999) 999 99 99")]): 9 a digit, a a
letter, A a letter written upper case, * a letter or digit, a backslash makes the
next character literal. Literals are shown while typing but never stored. See
crate::ui::mask_fits.
Embed
An address to embed with crate::ui::Embed (#[rule(embed)] on a String): an
https URL in the form crate::embed_url gives, on a host of the app’s frame-src
(App::csp). Forms take pasted embed code too and keep only its canonical address.
Format
The submitted value could not be read as the field’s type.
Custom
Raised by a model level validate = ... function.
Line
A problem in one cell of a lines field: the line (from 0) and the column.