pub struct GuardManager { /* private fields */ }Expand description
Guard manager
Implementations§
Source§impl GuardManager
impl GuardManager
Sourcepub fn new() -> GuardManager
pub fn new() -> GuardManager
Create an empty guard manager
Sourcepub fn from_guards(guards: Vec<Arc<dyn Guard>>) -> GuardManager
pub fn from_guards(guards: Vec<Arc<dyn Guard>>) -> GuardManager
Create a manager from a list of guards
Sourcepub async fn check_all(
&self,
content: &str,
direction: GuardDirection,
) -> Result<GuardResult, ReactError>
pub async fn check_all( &self, content: &str, direction: GuardDirection, ) -> Result<GuardResult, ReactError>
Run all guard checks in parallel.
- All guards start simultaneously (subject to concurrency cap), rather than running serially.
- Once a
Blockresult is detected, cancel other in-flight checks (viaCancellationToken). - Collect all
Warnreasons intoVec<String>.
The concurrency cap is 16 to prevent spawning an excessive number of tasks when many guards are registered.
Trait Implementations§
Source§impl Default for GuardManager
impl Default for GuardManager
Source§fn default() -> GuardManager
fn default() -> GuardManager
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for GuardManager
impl !RefUnwindSafe for GuardManager
impl Send for GuardManager
impl Sync for GuardManager
impl Unpin for GuardManager
impl UnsafeUnpin for GuardManager
impl !UnwindSafe for GuardManager
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request