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§
Sourcefn invoke<H>(
&self,
module: &FunctionModule,
event: EventPayload,
host: &H,
limits: ResourceLimits,
) -> impl Future<Output = Result<FunctionResult>> + Sendwhere
H: HostContext + ?Sized,
fn invoke<H>(
&self,
module: &FunctionModule,
event: EventPayload,
host: &H,
limits: ResourceLimits,
) -> impl Future<Output = Result<FunctionResult>> + Sendwhere
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
Sourcefn supported_extensions(&self) -> &[&str]
fn supported_extensions(&self) -> &[&str]
Get the list of file extensions this runtime supports.
Sourcefn supports_hot_reload(&self) -> bool
fn supports_hot_reload(&self) -> bool
Check if this runtime supports hot-reloading modules without restart.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".