rustrict 0.7.38

rustrict is a profanity filter for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use rustrict::{Censor, Type};

fn main() {
    let (censored, analysis) = Censor::from_str("123 Crap")
        .with_censor_first_character_threshold(Type::OFFENSIVE & Type::SEVERE)
        .with_ignore_false_positives(false)
        .with_censor_replacement('?')
        .censor_and_analyze();

    assert_eq!(censored, "123 C???");
    assert!(analysis.is(Type::INAPPROPRIATE));
    assert!(analysis.isnt(Type::PROFANE & Type::SEVERE | Type::SEXUAL));
}