pub struct ModerationResult { /* private fields */ }
Expand description
The result of a moderation operation.
Implementations§
Source§impl ModerationResult
impl ModerationResult
Sourcepub const fn new(flagged: bool, categories: Vec<ModerationCategory>) -> Self
pub const fn new(flagged: bool, categories: Vec<ModerationCategory>) -> Self
Creates a new moderation result.
§Arguments
flagged
- Whether the content was flagged as violating policiescategories
- List of detected violation categories with confidence scores
Sourcepub const fn is_flagged(&self) -> bool
pub const fn is_flagged(&self) -> bool
Returns whether the content was flagged.
Sourcepub fn categories(&self) -> &[ModerationCategory]
pub fn categories(&self) -> &[ModerationCategory]
Returns the detected violation categories.
Sourcepub fn violation_count(&self) -> usize
pub fn violation_count(&self) -> usize
Returns the number of detected violations.
Sourcepub fn has_violations(&self) -> bool
pub fn has_violations(&self) -> bool
Returns whether any violations were detected.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ModerationResult
impl RefUnwindSafe for ModerationResult
impl Send for ModerationResult
impl Sync for ModerationResult
impl Unpin for ModerationResult
impl UnwindSafe for ModerationResult
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
Mutably borrows from an owned value. Read more