Trait CensorStr

Source
pub trait CensorStr: Sized {
    // Required methods
    fn censor(self) -> String;
    fn is(self, threshold: Type) -> bool;

    // Provided methods
    fn is_inappropriate(self) -> bool { ... }
    fn isnt(self, threshold: Type) -> bool { ... }
}
Expand description

CensorStr makes it easy to sanitize a String or &str by calling .censor().

Required Methods§

Source

fn censor(self) -> String

The output is a newly allocated, censored string.

Source

fn is(self, threshold: Type) -> bool

Returns true if text meets the provided threshold.

Provided Methods§

Source

fn is_inappropriate(self) -> bool

Returns true if the text is inappropriate.

Source

fn isnt(self, threshold: Type) -> bool

Returns true if text does not meet the provided threshold.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl CensorStr for &str

Source§

fn censor(self) -> String

Source§

fn is(self, threshold: Type) -> bool

Implementors§