[−][src]Enum censor::Censor
A collection of words to censor
Variants
Standard swear words
For more information, see STANDARD_WORDS
Words that only the most zealous censors care about
Not usually used by itself
For more information, see ZEALOUS_WORDS
A custom set of words
Methods
impl Censor
[src]
pub fn empty() -> Self
[src]
Create an empty Censor
pub fn custom<I, W>(words: I) -> Self where
I: IntoIterator<Item = W>,
W: Into<String>,
[src]
I: IntoIterator<Item = W>,
W: Into<String>,
Create a Censor::Custom
pub fn check(&self, text: &str) -> bool
[src]
Check if a string contains censored words
pub fn censor(&self, text: &str) -> String
[src]
Replace censored words in the string with asterisks (*
s)
pub fn replace(&self, text: &str, replacement_char: char) -> String
[src]
Replace censored words in the string with a replacement character
pub fn bad_chars(&self, text: &str) -> HashSet<usize>
[src]
Get a set of the indices of characters in the given string that are part of censored words
pub fn set(&self) -> &HashSet<String>
[src]
Get a reference to the set used by the Censor
pub fn list(&self) -> Iter<String>
[src]
Get an iterator over all censored words
pub fn find(&self, word: &str) -> Option<&str>
[src]
Find a censored word in the Censor
. Applies character aliases
pub fn contains(&self, word: &str) -> bool
[src]
Check if the Censor
contains a word. Applies character aliases
Trait Implementations
impl Eq for Censor
[src]
impl Default for Censor
[src]
impl Clone for Censor
[src]
impl PartialEq<Censor> for Censor
[src]
impl Add<Censor> for Censor
[src]
type Output = Censor
The resulting type after applying the +
operator.
fn add(self, other: Self) -> Self::Output
[src]
impl<S> Add<S> for Censor where
S: Into<String>,
[src]
S: Into<String>,
type Output = Censor
The resulting type after applying the +
operator.
fn add(self, other: S) -> Self::Output
[src]
impl Sub<Censor> for Censor
[src]
type Output = Censor
The resulting type after applying the -
operator.
fn sub(self, other: Self) -> Self::Output
[src]
impl<S> Sub<S> for Censor where
S: Into<String>,
[src]
S: Into<String>,
type Output = Censor
The resulting type after applying the -
operator.
fn sub(self, other: S) -> Self::Output
[src]
impl AddAssign<Censor> for Censor
[src]
fn add_assign(&mut self, other: Self)
[src]
impl<S> AddAssign<S> for Censor where
S: Into<String>,
[src]
S: Into<String>,
fn add_assign(&mut self, other: S)
[src]
impl SubAssign<Censor> for Censor
[src]
fn sub_assign(&mut self, other: Self)
[src]
impl<S> SubAssign<S> for Censor where
S: Into<String>,
[src]
S: Into<String>,
fn sub_assign(&mut self, other: S)
[src]
impl Debug for Censor
[src]
Auto Trait Implementations
impl Send for Censor
impl Unpin for Censor
impl Sync for Censor
impl UnwindSafe for Censor
impl RefUnwindSafe for Censor
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,