pub struct Trie { /* private fields */ }Expand description
Efficiently stores profanity, false positives, and safe words.
Implementations§
source§impl Trie
impl Trie
sourcepub unsafe fn customize_default() -> &'static mut Self
Available on crate feature customize only.
pub unsafe fn customize_default() -> &'static mut Self
customize only.Allows direct mutable access to the global default trie of words.
Prefer the safe API Censor::with_trie.
§Safety
You must manually avoid concurrent access/censoring.
sourcepub fn set(&mut self, word: &str, typ: Type)
pub fn set(&mut self, word: &str, typ: Type)
Adds a word, with the given type. The type can be Type::SAFE, or a combination of Type::PROFANE,
Type::Sexual, Type::Offensive, Type::Mean, Type::Mild, Type::Moderate, and Type::Severe,
but NOT both (can’t be safe and unsafe).
It is recommended to use all lower-case, which will match both cases. Upper-case characters will only match upper-case.
§Warning
Any profanity words added this way will not support false positives. For example, if you add the word
“field,” you can expect “cornfield” to be detected as well, unless you call add_word("cornfield", Type::None).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Trie
impl RefUnwindSafe for Trie
impl Send for Trie
impl Sync for Trie
impl Unpin for Trie
impl UnwindSafe for Trie
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)