pub struct AsyncGuard { /* private fields */ }Expand description
Like crate::Guard, but also runs AsyncValidators. Sync validators run
first (cheap); async ones only run if those all pass, to avoid a network call
on output that already fails a free local check.
Implementations§
Source§impl AsyncGuard
impl AsyncGuard
pub fn new() -> Self
Sourcepub fn from_guard(guard: Guard) -> Self
pub fn from_guard(guard: Guard) -> Self
Start from an existing crate::Guard’s sync validators, e.g. one loaded
with [crate::spec::guard_from_file], then add async checks with with_async.
pub fn with(self, validator: impl Validator + 'static) -> Self
pub fn with_async(self, validator: impl AsyncValidator + 'static) -> Self
pub async fn check(&self, text: &str) -> GuardResult
Trait Implementations§
Source§impl Default for AsyncGuard
impl Default for AsyncGuard
Source§fn default() -> AsyncGuard
fn default() -> AsyncGuard
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for AsyncGuard
impl !UnwindSafe for AsyncGuard
impl Freeze for AsyncGuard
impl Send for AsyncGuard
impl Sync for AsyncGuard
impl Unpin for AsyncGuard
impl UnsafeUnpin for AsyncGuard
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