InvocationContext

Trait InvocationContext 

Source
pub trait InvocationContext: Send + Sync {
    // Required methods
    fn sql<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        config: &'life1 SurrealismConfig,
        query: String,
        vars: Object,
    ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn run<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        config: &'life1 SurrealismConfig,
        fnc: String,
        version: Option<String>,
        args: Vec<Value>,
    ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn kv(&mut self) -> Result<&dyn KVStore>;

    // Provided methods
    fn stdout(&mut self, output: &str) -> Result<()> { ... }
    fn stderr(&mut self, output: &str) -> Result<()> { ... }
}
Expand description

Context provided for each WASM function invocation. Created per-call with borrowed execution context (stack, query context, etc).

Required Methods§

Source

fn sql<'life0, 'life1, 'async_trait>( &'life0 mut self, config: &'life1 SurrealismConfig, query: String, vars: Object, ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn run<'life0, 'life1, 'async_trait>( &'life0 mut self, config: &'life1 SurrealismConfig, fnc: String, version: Option<String>, args: Vec<Value>, ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn kv(&mut self) -> Result<&dyn KVStore>

Provided Methods§

Source

fn stdout(&mut self, output: &str) -> Result<()>

Handle stdout output from the WASM module

Source

fn stderr(&mut self, output: &str) -> Result<()>

Handle stderr output from the WASM module

Implementors§