[][src]Enum censor::Censor

pub enum Censor {
    Standard,
    Sex,
    Zealous,
    Custom(HashSet<String>),
}

A collection of words to censor

Variants

Standard

Standard swear words

For more information, see STANDARD_WORDS

Sex

Words having to do with sex

Not usually used by itself

For more information, see SEX_WORDS

Zealous

Words that only the most zealous censors care about

Not usually used by itself

For more information, see ZEALOUS_WORDS

Custom(HashSet<String>)

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]

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.

impl<S> Add<S> for Censor where
    S: Into<String>, 
[src]

type Output = Censor

The resulting type after applying the + operator.

impl Sub<Censor> for Censor[src]

type Output = Censor

The resulting type after applying the - operator.

impl<S> Sub<S> for Censor where
    S: Into<String>, 
[src]

type Output = Censor

The resulting type after applying the - operator.

impl AddAssign<Censor> for Censor[src]

impl<S> AddAssign<S> for Censor where
    S: Into<String>, 
[src]

impl SubAssign<Censor> for Censor[src]

impl<S> SubAssign<S> for Censor where
    S: Into<String>, 
[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]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]