pub struct LengthGuard { /* private fields */ }Expand description
Length guard to limit content size
Implementations§
Source§impl LengthGuard
impl LengthGuard
Sourcepub fn with_max_chars(self, max: usize) -> Self
pub fn with_max_chars(self, max: usize) -> Self
Set maximum character limit
Sourcepub fn with_max_tokens(self, max: usize) -> Self
pub fn with_max_tokens(self, max: usize) -> Self
Set maximum token limit
Sourcepub fn with_action(self, action: GuardAction) -> Self
pub fn with_action(self, action: GuardAction) -> Self
Set the action
Trait Implementations§
Source§impl Guard for LengthGuard
impl Guard for LengthGuard
Source§fn check(&self, content: &str) -> GuardCheckResult
fn check(&self, content: &str) -> GuardCheckResult
Check content against this guard
Source§fn action(&self) -> GuardAction
fn action(&self) -> GuardAction
Get the action this guard takes on failure
Source§fn severity_threshold(&self) -> Severity
fn severity_threshold(&self) -> Severity
Get the minimum severity that triggers this guard
Auto Trait Implementations§
impl Freeze for LengthGuard
impl RefUnwindSafe for LengthGuard
impl Send for LengthGuard
impl Sync for LengthGuard
impl Unpin for LengthGuard
impl UnwindSafe for LengthGuard
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<G> InstrumentGuard for Gwhere
G: Guard,
impl<G> InstrumentGuard for Gwhere
G: Guard,
Source§fn instrumented(self) -> InstrumentedGuard<Self>
fn instrumented(self) -> InstrumentedGuard<Self>
Wrap this guard with metrics instrumentation
Source§fn instrumented_with(
self,
collector: Arc<GuardMetricsCollector>,
) -> InstrumentedGuard<Self>
fn instrumented_with( self, collector: Arc<GuardMetricsCollector>, ) -> InstrumentedGuard<Self>
Wrap this guard with a specific collector