pub struct InputValidator { /* private fields */ }Expand description
Input validator for security
Implementations§
Source§impl InputValidator
impl InputValidator
Sourcepub fn new(config: SanitizationConfig) -> Self
pub fn new(config: SanitizationConfig) -> Self
Create a new input validator
Sourcepub fn validate(&self, input: &str) -> SecurityResult<String>
pub fn validate(&self, input: &str) -> SecurityResult<String>
Validate and sanitize input
Sourcepub fn validate_email(&self, email: &str) -> SecurityResult<String>
pub fn validate_email(&self, email: &str) -> SecurityResult<String>
Validate an email address
Sourcepub fn validate_username(&self, username: &str) -> SecurityResult<String>
pub fn validate_username(&self, username: &str) -> SecurityResult<String>
Validate a username
Sourcepub fn validate_config_key(&self, key: &str) -> SecurityResult<String>
pub fn validate_config_key(&self, key: &str) -> SecurityResult<String>
Validate a configuration key
Sourcepub fn validate_url(&self, url: &str) -> SecurityResult<String>
pub fn validate_url(&self, url: &str) -> SecurityResult<String>
Validate a URL
Sourcepub fn validate_json(&self, json: &str) -> SecurityResult<Value>
pub fn validate_json(&self, json: &str) -> SecurityResult<Value>
Validate JSON input
Auto Trait Implementations§
impl Freeze for InputValidator
impl RefUnwindSafe for InputValidator
impl Send for InputValidator
impl Sync for InputValidator
impl Unpin 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