pub struct Filters {
pub alphanumeric: bool,
pub case_sensitive: bool,
pub min_length: i32,
pub max_length: i32,
pub punctuation: bool,
pub numbers: bool,
pub special_characters: bool,
pub accept_special_characters: Option<String>,
pub list_of_special_characters: Option<HashSet<char>>,
}Expand description
A struct used to deserialize filters from the configuration file.
Fields§
§alphanumeric: bool§case_sensitive: bool§min_length: i32§max_length: i32§punctuation: bool§numbers: bool§special_characters: bool§accept_special_characters: Option<String>§list_of_special_characters: Option<HashSet<char>>Implementations§
source§impl Filters
impl Filters
pub fn set_special_characters(&mut self)
pub fn get_special_characters(&self) -> HashSet<char>
sourcepub fn is_valid(&self, text: &str) -> bool
pub fn is_valid(&self, text: &str) -> bool
Checks if a string is a valid entity. Using the configuration file, it checks if the string is alphanumeric, contains punctuation, numbers, or special characters.
Examples
use utils::is_valid;
let text = "Hello, world!";
assert_eq!(is_valid(config, text), true);Trait Implementations§
source§impl<'de> Deserialize<'de> for Filters
impl<'de> Deserialize<'de> for Filters
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>,
Deserialize this value from the given Serde deserializer. Read more