Struct rustrict::Context

source ·
pub struct Context { /* private fields */ }
Expand description

Context is useful for taking moderation actions on a per-user basis i.e. each user would get their own Context.

Implementations§

Takes user message, returns censored message trimmed of whitespace (if it should be sent) or BlockReason (explaining why it should be blocked entirely).

Takes user message, returns censored message trimmed of whitespace (if it should be sent) or BlockReason (explaining why it should be blocked entirely).

Takes a set of options for fine-tuning the processing.

Returns how long the user is muted for (possibly Duration::ZERO).

Returns the latest instant the user is muted (possibly in the past).

Returns how long the user is restricted to Type::SAFE for (possibly Duration::ZERO).

Returns the latest instant the user is restricted (possibly in the past).

Manually mute this user’s messages for a duration. Overwrites any previous manual mute. Passing Duration::ZERO will therefore un-mute.

Manually mute this user’s messages until an instant. Overwrites any previous manual mute. Passing an instant in the past will therefore un-mute.

Manually restrict this user’s messages to known safe phrases for a duration. Overwrites any previous manual restriction. Passing Duration::ZERO will therefore un-restrict.

Manually restrict this user’s messages to known safe phrases until an instant. Overwrites any previous manual restriction. Passing an instant in the past will therefore un-restrict.

Call if another user “reports” this user’s message(s). The function of reports is for suspicion of bad behavior to be confirmed faster.

Returns number of reports received via Self::report(). It is not guaranteed that the full range of usize of reports will be counted (currently only u8::MAX are counted).

Clear suspicion and reports, and automatic mutes (not manual mute or rate limit).

Returns total number of messages processed. It is not guaranteed that the full range of usize of messages will be counted (currently only u16::MAX are counted).

Returns total number of messages processed that were Type::INAPPROPRIATE. It is not guaranteed that the full range of usize of messages will be counted (currently only u16::MAX are counted).

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.