pub struct FormatOptions {
pub case_sensitive: bool,
pub trim_before_check: bool,
pub null_is_valid: bool,
}Expand description
Options for format constraint behavior.
Fields§
§case_sensitive: boolWhether pattern matching should be case sensitive
trim_before_check: boolWhether to trim whitespace before checking format
null_is_valid: boolWhether NULL values should be considered valid
Implementations§
Source§impl FormatOptions
impl FormatOptions
Sourcepub fn case_sensitive(self, case_sensitive: bool) -> Self
pub fn case_sensitive(self, case_sensitive: bool) -> Self
Sets case sensitivity for pattern matching.
Sourcepub fn trim_before_check(self, trim: bool) -> Self
pub fn trim_before_check(self, trim: bool) -> Self
Sets whether to trim whitespace before format checking.
Sourcepub fn null_is_valid(self, null_valid: bool) -> Self
pub fn null_is_valid(self, null_valid: bool) -> Self
Sets whether NULL values should be considered valid.
Sourcepub fn case_insensitive() -> Self
pub fn case_insensitive() -> Self
Creates format options for case-insensitive matching.
This is a convenience method that sets case_sensitive to false.
§Examples
use term_guard::constraints::FormatOptions;
let options = FormatOptions::case_insensitive();
assert_eq!(options.case_sensitive, false);Sourcepub fn strict() -> Self
pub fn strict() -> Self
Creates format options for strict validation (no nulls, case sensitive, no trimming).
This is a convenience method for the most restrictive validation.
§Examples
use term_guard::constraints::FormatOptions;
let options = FormatOptions::strict();
assert_eq!(options.case_sensitive, true);
assert_eq!(options.trim_before_check, false);
assert_eq!(options.null_is_valid, false);Sourcepub fn lenient() -> Self
pub fn lenient() -> Self
Creates format options for lenient validation (case insensitive, trimming, nulls allowed).
This is a convenience method for the most permissive validation.
§Examples
use term_guard::constraints::FormatOptions;
let options = FormatOptions::lenient();
assert_eq!(options.case_sensitive, false);
assert_eq!(options.trim_before_check, true);
assert_eq!(options.null_is_valid, true);Sourcepub fn with_trimming() -> Self
pub fn with_trimming() -> Self
Creates format options with trimming enabled.
This is a convenience method that enables whitespace trimming before validation.
§Examples
use term_guard::constraints::FormatOptions;
let options = FormatOptions::with_trimming();
assert_eq!(options.trim_before_check, true);Trait Implementations§
Source§impl Clone for FormatOptions
impl Clone for FormatOptions
Source§fn clone(&self) -> FormatOptions
fn clone(&self) -> FormatOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FormatOptions
impl Debug for FormatOptions
Source§impl Default for FormatOptions
impl Default for FormatOptions
Source§impl<'de> Deserialize<'de> for FormatOptions
impl<'de> Deserialize<'de> for FormatOptions
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for FormatOptions
impl PartialEq for FormatOptions
Source§impl Serialize for FormatOptions
impl Serialize for FormatOptions
impl StructuralPartialEq for FormatOptions
Auto Trait Implementations§
impl Freeze for FormatOptions
impl RefUnwindSafe for FormatOptions
impl Send for FormatOptions
impl Sync for FormatOptions
impl Unpin for FormatOptions
impl UnwindSafe for FormatOptions
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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more