pub trait AsyncValidatable<Key>where
Key: 'static,{
// Required method
fn validate_future(
&self,
) -> Pin<Box<dyn Future<Output = Result<(), ValidationErrors<Key>>>>>;
// Provided method
fn validate_future_or_empty(
&self,
) -> Pin<Box<dyn Future<Output = ValidationErrors<Key>>>> { ... }
}
Available on crate feature
async
only.Expand description
An item that can be validated asynchronously.
See Validatable for the synchronous version.
Required Methods§
Sourcefn validate_future(
&self,
) -> Pin<Box<dyn Future<Output = Result<(), ValidationErrors<Key>>>>>
fn validate_future( &self, ) -> Pin<Box<dyn Future<Output = Result<(), ValidationErrors<Key>>>>>
Creates a future that will validate this item. The future
returns Ok(())
if no errors were encountered, and returns
Err(ValidationErrors)
if any errors were encountered.
Provided Methods§
Sourcefn validate_future_or_empty(
&self,
) -> Pin<Box<dyn Future<Output = ValidationErrors<Key>>>>
fn validate_future_or_empty( &self, ) -> Pin<Box<dyn Future<Output = ValidationErrors<Key>>>>
Creates a future that will validate this item. The future returns an empty ValidationErrors if no errors were encountered during validation.