Skip to main content

FunctionRuntime

Trait FunctionRuntime 

Source
pub trait FunctionRuntime: Send + Sync {
    // Required methods
    fn invoke<H>(
        &self,
        module: &FunctionModule,
        event: EventPayload,
        host: &H,
        limits: ResourceLimits,
    ) -> impl Future<Output = Result<FunctionResult>> + Send
       where H: HostContext + ?Sized;
    fn supported_extensions(&self) -> &[&str];
    fn supports_hot_reload(&self) -> bool;
    fn name(&self) -> &str;
}
Expand description

Trait for function execution backends (WASM, Deno, etc.).

Implementors provide the ability to load and execute function modules with resource limits enforced. This trait uses native async for zero-cost abstraction on hot paths.

Required Methods§

Source

fn invoke<H>( &self, module: &FunctionModule, event: EventPayload, host: &H, limits: ResourceLimits, ) -> impl Future<Output = Result<FunctionResult>> + Send
where H: HostContext + ?Sized,

Execute a function module with the given event and host context.

§Errors

Returns Err if:

  • The module cannot be loaded or parsed
  • Execution raises an error (runtime error, timeout, memory limit exceeded)
  • The host context raises an error
Source

fn supported_extensions(&self) -> &[&str]

Get the list of file extensions this runtime supports.

Source

fn supports_hot_reload(&self) -> bool

Check if this runtime supports hot-reloading modules without restart.

Source

fn name(&self) -> &str

Get the name of this runtime (e.g., “wasm”, “deno”).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§