pub struct DefenseResult {
pub safe: bool,
pub category: DefenseCategory,
pub action: PolicyAction,
pub details: Vec<String>,
pub score: f64,
pub sanitized_content: Option<String>,
}Expand description
Result of a security defense check
Fields§
§safe: boolWhether the content is safe
category: DefenseCategoryDefense category that generated this result
action: PolicyActionAction taken by policy engine
details: Vec<String>Detection details (pattern names, reasons)
score: f64Risk score (0.0-1.0)
sanitized_content: Option<String>Sanitized version of content (if action == Sanitize)
Implementations§
Source§impl DefenseResult
impl DefenseResult
Sourcepub fn safe(category: DefenseCategory) -> Self
pub fn safe(category: DefenseCategory) -> Self
Create a safe result (no detections)
Sourcepub fn detected(
category: DefenseCategory,
action: PolicyAction,
details: Vec<String>,
score: f64,
) -> Self
pub fn detected( category: DefenseCategory, action: PolicyAction, details: Vec<String>, score: f64, ) -> Self
Create a detection result
Sourcepub fn blocked(category: DefenseCategory, reason: String) -> Self
pub fn blocked(category: DefenseCategory, reason: String) -> Self
Create a blocked result
Sourcepub fn with_sanitized(self, content: String) -> Self
pub fn with_sanitized(self, content: String) -> Self
Add sanitized content
Trait Implementations§
Source§impl Clone for DefenseResult
impl Clone for DefenseResult
Source§fn clone(&self) -> DefenseResult
fn clone(&self) -> DefenseResult
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DefenseResult
impl RefUnwindSafe for DefenseResult
impl Send for DefenseResult
impl Sync for DefenseResult
impl Unpin for DefenseResult
impl UnsafeUnpin for DefenseResult
impl UnwindSafe for DefenseResult
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