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 moresource§impl Debug for FieldAttrs
impl Debug for FieldAttrs
source§impl Default for FieldAttrs
impl Default for FieldAttrs
impl Copy for FieldAttrs
Auto Trait Implementations§
impl Freeze for FieldAttrs
impl RefUnwindSafe for FieldAttrs
impl Send for FieldAttrs
impl Sync for FieldAttrs
impl Unpin for FieldAttrs
impl UnwindSafe for FieldAttrs
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)