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: PiiMode,
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: boolIf the field is required.
nonempty: boolIf the field should be non-empty.
trim_whitespace: boolWhether 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: usizeThe 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: PiiModeThe type of PII on the field.
retain: boolWhether additional properties should be retained during normalization.
trim: boolWhether 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.
Sourcepub const fn pii_dynamic(self, pii: fn(&ProcessingState<'_>) -> Pii) -> Self
pub const fn pii_dynamic(self, pii: fn(&ProcessingState<'_>) -> Pii) -> Self
Sets whether this field contains PII dynamically based on the current state.
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