pub trait AsyncValidator: Send + Sync {
// Required methods
fn validate_async<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
value: &'life1 str,
field: &'life2 str,
) -> Pin<Box<dyn Future<Output = AsyncValidatorResult> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn provider(&self) -> AsyncValidatorProvider;
fn timeout(&self) -> Duration;
}Expand description
Trait for async validators.
Implementers should handle timeout and error cases gracefully.
Required Methods§
Sourcefn validate_async<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
value: &'life1 str,
field: &'life2 str,
) -> Pin<Box<dyn Future<Output = AsyncValidatorResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn validate_async<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
value: &'life1 str,
field: &'life2 str,
) -> Pin<Box<dyn Future<Output = AsyncValidatorResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sourcefn provider(&self) -> AsyncValidatorProvider
fn provider(&self) -> AsyncValidatorProvider
Get the provider this validator uses