pub struct InputValidator { /* private fields */ }Expand description
输入验证器
Implementations§
Source§impl InputValidator
impl InputValidator
pub fn new() -> Self
Sourcepub fn validate(&self, input: &str) -> Result<ValidationResult>
pub fn validate(&self, input: &str) -> Result<ValidationResult>
验证输入
Sourcepub fn with_max_length(self, max_length: usize) -> Self
pub fn with_max_length(self, max_length: usize) -> Self
设置最大长度
Sourcepub fn add_forbidden_pattern(self, pattern: String) -> Self
pub fn add_forbidden_pattern(self, pattern: String) -> Self
添加禁止模式
Trait Implementations§
Auto Trait Implementations§
impl Freeze for InputValidator
impl RefUnwindSafe for InputValidator
impl Send for InputValidator
impl Sync for InputValidator
impl Unpin for InputValidator
impl UnsafeUnpin for InputValidator
impl UnwindSafe for InputValidator
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
Mutably borrows from an owned value. Read more