pub struct FieldAttrs {
pub name: Option<&'static str>,
pub required: bool,
pub nonempty: bool,
pub trim_whitespace: bool,
pub characters: Option<CharacterSet>,
pub max_chars: Option<usize>,
pub max_chars_allowance: usize,
pub max_depth: Option<usize>,
pub max_bytes: Option<usize>,
pub pii: Pii,
pub retain: bool,
pub trim: bool,
}
Expand description
Meta information about a field.
Fields§
§name: Option<&'static str>
Optionally the name of the field.
required: bool
If the field is required.
nonempty: bool
If the field should be non-empty.
trim_whitespace: bool
Whether to trim whitespace from this string.
characters: Option<CharacterSet>
A set of allowed or denied character ranges for this string.
max_chars: Option<usize>
The maximum char length of this field.
max_chars_allowance: usize
The extra char length allowance on top of max_chars.
max_depth: Option<usize>
The maximum depth of this field.
max_bytes: Option<usize>
The maximum number of bytes of this field.
pii: Pii
The type of PII on the field.
retain: bool
Whether additional properties should be retained during normalization.
trim: bool
Whether the trimming processor is allowed to shorten or drop this field.
Implementations§
Source§impl FieldAttrs
impl FieldAttrs
Sourcepub const fn required(self, required: bool) -> Self
pub const fn required(self, required: bool) -> Self
Sets whether a value in this field is required.
Sourcepub const fn nonempty(self, nonempty: bool) -> Self
pub const fn nonempty(self, nonempty: bool) -> Self
Sets whether this field can have an empty value.
This is distinct from required
. An empty string (""
) passes the “required” check but not the
“nonempty” one.
Sourcepub const fn trim_whitespace(self, trim_whitespace: bool) -> Self
pub const fn trim_whitespace(self, trim_whitespace: bool) -> Self
Sets whether whitespace should be trimmed before validation.
Trait Implementations§
Source§impl Clone for FieldAttrs
impl Clone for FieldAttrs
Source§fn clone(&self) -> FieldAttrs
fn clone(&self) -> FieldAttrs
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more