Context

Trait Context 

Source
pub trait Context: Send + Sync {
    // Required method
    fn get_var<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Value>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn get_fn(&self, name: &str) -> Option<&Box<dyn ExprFn>> { ... }
}
Expand description

The context of the filter for evaluation.

Required Methods§

Source

fn get_var<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Value>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the value of a variable/field.

It is a async function so that the callee can even request the database or network to get the value.

If the variable is not found, return None.

If some error occurs, return the error.

Provided Methods§

Source

fn get_fn(&self, name: &str) -> Option<&Box<dyn ExprFn>>

Get the function by name.

If the function is not found, return None.

Implementors§