pub struct ExcludeSet(/* private fields */);Expand description
Regex patterns used to exclude matching words.
§Examples
use word_tally::ExcludeSet;
// Create a pattern to exclude words ending with "ly"
let patterns = ExcludeSet::new(vec!["ly$".to_string()]).unwrap();
// Test matching
assert!(patterns.matches("quickly"));
assert!(!patterns.matches("quick"));Implementations§
Source§impl ExcludeSet
impl ExcludeSet
Sourcepub fn new(input_patterns: PatternList) -> Result<Self, WordTallyError>
pub fn new(input_patterns: PatternList) -> Result<Self, WordTallyError>
Creates patterns from owned pattern strings.
§Examples
use word_tally::ExcludeSet;
// Create pattern for excluding numeric words
let patterns = ExcludeSet::new(vec![r"^\d+$".to_string()]).unwrap();
assert_eq!(patterns.len(), 1);
// Test empty patterns
let empty = ExcludeSet::default();
assert!(empty.is_empty());§Errors
Returns an error if any pattern cannot be compiled into a valid regular expression.
Sourcepub fn as_patterns(&self) -> &[String]
pub fn as_patterns(&self) -> &[String]
Returns a slice of the original pattern strings.
Trait Implementations§
Source§impl AsRef<[String]> for ExcludeSet
impl AsRef<[String]> for ExcludeSet
Source§impl Clone for ExcludeSet
impl Clone for ExcludeSet
Source§fn clone(&self) -> ExcludeSet
fn clone(&self) -> ExcludeSet
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ExcludeSet
impl Debug for ExcludeSet
Source§impl Default for ExcludeSet
impl Default for ExcludeSet
Source§fn default() -> ExcludeSet
fn default() -> ExcludeSet
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ExcludeSet
impl<'de> Deserialize<'de> for ExcludeSet
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
Source§impl Display for ExcludeSet
impl Display for ExcludeSet
Source§impl Hash for ExcludeSet
impl Hash for ExcludeSet
Source§impl Ord for ExcludeSet
impl Ord for ExcludeSet
Source§impl PartialEq for ExcludeSet
impl PartialEq for ExcludeSet
Source§impl PartialOrd for ExcludeSet
impl PartialOrd for ExcludeSet
Source§impl Serialize for ExcludeSet
impl Serialize for ExcludeSet
Source§impl<'a> TryFrom<&'a [String]> for ExcludeSet
impl<'a> TryFrom<&'a [String]> for ExcludeSet
impl Eq for ExcludeSet
Auto Trait Implementations§
impl Freeze for ExcludeSet
impl RefUnwindSafe for ExcludeSet
impl Send for ExcludeSet
impl Sync for ExcludeSet
impl Unpin for ExcludeSet
impl UnwindSafe for ExcludeSet
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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>
Converts
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>
Converts
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