Trait Middleware

Source
pub trait Middleware: Send + Sync {
    // Required methods
    fn before_dispatch<'life0, 'life1, 'async_trait>(
        &'life0 self,
        transaction: &'life1 mut Transaction,
    ) -> Pin<Box<dyn Future<Output = EditorResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn after_dispatch<'life0, 'async_trait>(
        &'life0 self,
        state: Option<Arc<State>>,
    ) -> Pin<Box<dyn Future<Output = EditorResult<MiddlewareResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Middleware trait that can be implemented for transaction processing

Required Methods§

Source

fn before_dispatch<'life0, 'life1, 'async_trait>( &'life0 self, transaction: &'life1 mut Transaction, ) -> Pin<Box<dyn Future<Output = EditorResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Process the transaction before it reaches the core dispatch

Source

fn after_dispatch<'life0, 'async_trait>( &'life0 self, state: Option<Arc<State>>, ) -> Pin<Box<dyn Future<Output = EditorResult<MiddlewareResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Process the result after the core dispatch Returns a MiddlewareResult that may contain additional transactions to be processed

Implementors§