Skip to main content

AsyncValidator

Trait AsyncValidator 

Source
pub trait AsyncValidator: Send + Sync {
    // Required method
    fn validate<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        value: &'life1 str,
        record_id: Option<&'life2 Value>,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Asynchronous field validator. Used for validators that need DB access (e.g. Unique). record_id is the current record’s PK — pass Some on edit, None on create.

Required Methods§

Source

fn validate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, value: &'life1 str, record_id: Option<&'life2 Value>, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Trait Implementations§

Source§

impl Debug for dyn AsyncValidator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Implementors§