Crate rustrict

Crate rustrict 

Source

Structs§

Bannedcensor
Set of character to strip from input without replacement.
Censorcensor
Censor is a flexible profanity filter that can analyze and/or censor arbitrary text.
Contextcontext
Context is useful for taking moderation actions on a per-user basis i.e. each user would get their own Context.
ContextProcessingOptionscontext
Options for customizing Context::process_with_options. Always initialize with ..Default::default(), as new fields may be added in the future.
ContextRateLimitOptionscontext
Options that control rate-limiting.
ContextRepetitionLimitOptionscontext
Options that control repetition-limiting.
ContextWordBreakOptionscontext and width
Options that ensure word break will be possible.
Replacementscensor
Set of possible interpretations for an input character.
Triecensor
Efficiently stores profanity, false positives, and safe words.
Typecensor
Type is represents a type or severity of inappropriateness. They can be combined with bitwise AND and OR operators, and are not mutually exclusive.

Enums§

BlockReasoncontext
Communicates why a message was blocked as opposed to merely censored.
WordBreakwidth
How text is expected to be displayed.

Traits§

CensorItercensor
CensorIter makes it easy to sanitize an arbitrary Iterator<Item=char> by calling .censor().
CensorStrcensor
CensorStr makes it easy to sanitize a String or &str by calling .censor().

Functions§

add_wordDeprecatedcustomize
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).
is_whitespace
Returns true iff the character is effectively whitespace. The definition of whitespace is broader than that of Unicode, because it includes control characters and a few additional blank characters.
trim_to_widthwidth
Trims a string to a maximum number of m’s. A budget of 5 would allow five m, or more narrower characters, or fewer wider characters.
trim_whitespace
Trims whitespace characters from both ends of a string, according to the definition of crate::is_whitespace.
widthwidth
Returns an estimate of the worst-case display width in milli-m’s (thousandths of the the width of an m character).
width_strwidth
Convenience method for getting the width, in m’s, of an entire string.
width_str_max_unbrokenwidth
Like width_str but computes the width of the max unbroken (no line break) part of the string.