pub struct ProcessingStateBuilder { /* private fields */ }Expand description
A builder for root ProcessingStates.
This is created by ProcessingState::root_builder.
Implementations§
Source§impl ProcessingStateBuilder
impl ProcessingStateBuilder
Sourcepub fn attrs<F: FnOnce(FieldAttrs) -> FieldAttrs>(self, f: F) -> Self
pub fn attrs<F: FnOnce(FieldAttrs) -> FieldAttrs>(self, f: F) -> Self
Modifies the attributes of the root field.
Sourcepub fn required(self, required: bool) -> Self
pub fn required(self, required: bool) -> Self
Sets whether a value in the root field is required.
Sourcepub fn nonempty(self, nonempty: bool) -> Self
pub fn nonempty(self, nonempty: bool) -> Self
Sets whether the root field’s value must be nonempty.
This is distinct from required. An empty string ("") passes the “required” check but not the
“nonempty” one.
Sourcepub fn trim_whitespace(self, trim_whitespace: bool) -> Self
pub fn trim_whitespace(self, trim_whitespace: bool) -> Self
Sets whether whitespace should be trimmed on the root field before validation.
Sourcepub fn pii_dynamic(self, pii: fn(&ProcessingState<'_>) -> Pii) -> Self
pub fn pii_dynamic(self, pii: fn(&ProcessingState<'_>) -> Pii) -> Self
Sets whether the root field contains PII dynamically based on the current state.
Sourcepub fn max_chars(self, max_chars: impl Into<Option<usize>>) -> Self
pub fn max_chars(self, max_chars: impl Into<Option<usize>>) -> Self
Sets the maximum number of chars allowed in the root field.
Sourcepub fn max_chars_dynamic(
self,
max_chars: fn(&ProcessingState<'_>) -> Option<usize>,
) -> Self
pub fn max_chars_dynamic( self, max_chars: fn(&ProcessingState<'_>) -> Option<usize>, ) -> Self
Sets the maximum number of characters allowed in the root field dynamically based on the current state.
Sourcepub fn max_bytes(self, max_bytes: impl Into<Option<usize>>) -> Self
pub fn max_bytes(self, max_bytes: impl Into<Option<usize>>) -> Self
Sets the maximum number of bytes allowed in the root field.
Sourcepub fn max_bytes_dynamic(
self,
max_bytes: fn(&ProcessingState<'_>) -> Option<usize>,
) -> Self
pub fn max_bytes_dynamic( self, max_bytes: fn(&ProcessingState<'_>) -> Option<usize>, ) -> Self
Sets the maximum number of bytes allowed in the root field dynamically based on the current state.
Sourcepub fn retain(self, retain: bool) -> Self
pub fn retain(self, retain: bool) -> Self
Sets whether additional properties should be retained during normalization.
Sourcepub fn value_type(self, value_type: EnumSet<ValueType>) -> Self
pub fn value_type(self, value_type: EnumSet<ValueType>) -> Self
Sets the value type for the root state.
Sourcepub fn build(self) -> ProcessingState<'static>
pub fn build(self) -> ProcessingState<'static>
Consumes the builder and returns a root ProcessingState with
the configured attributes and value type.
Trait Implementations§
Source§impl Clone for ProcessingStateBuilder
impl Clone for ProcessingStateBuilder
Source§fn clone(&self) -> ProcessingStateBuilder
fn clone(&self) -> ProcessingStateBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more