pub struct GuardResult {
pub allowed: bool,
pub guard: String,
pub severity: Severity,
pub message: String,
pub details: Option<Value>,
}Expand description
Result of a guard check
Fields§
§allowed: boolWhether the action is allowed
guard: StringGuard that produced this result
severity: SeveritySeverity of any violation
message: StringHuman-readable message
details: Option<Value>Optional details
Implementations§
Source§impl GuardResult
impl GuardResult
Sourcepub fn block(
guard: impl Into<String>,
severity: Severity,
message: impl Into<String>,
) -> Self
pub fn block( guard: impl Into<String>, severity: Severity, message: impl Into<String>, ) -> Self
Create a block result
Sourcepub fn warn(guard: impl Into<String>, message: impl Into<String>) -> Self
pub fn warn(guard: impl Into<String>, message: impl Into<String>) -> Self
Create a warning result (allowed but logged)
Sourcepub fn with_details(self, details: Value) -> Self
pub fn with_details(self, details: Value) -> Self
Add details to the result
Trait Implementations§
Source§impl Clone for GuardResult
impl Clone for GuardResult
Source§fn clone(&self) -> GuardResult
fn clone(&self) -> GuardResult
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 moreSource§impl Debug for GuardResult
impl Debug for GuardResult
Source§impl<'de> Deserialize<'de> for GuardResult
impl<'de> Deserialize<'de> for GuardResult
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for GuardResult
impl RefUnwindSafe for GuardResult
impl Send for GuardResult
impl Sync for GuardResult
impl Unpin for GuardResult
impl UnwindSafe for GuardResult
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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