referrerpolicy=no-referrer-when-downgrade
sp_core::traits

Trait CodeExecutor

Source
pub trait CodeExecutor:
    Sized
    + Send
    + Sync
    + ReadRuntimeVersion
    + Clone
    + 'static {
    type Error: Display + Debug + Send + Sync + 'static;

    // Required method
    fn call(
        &self,
        ext: &mut dyn Externalities,
        runtime_code: &RuntimeCode<'_>,
        method: &str,
        data: &[u8],
        context: CallContext,
    ) -> (Result<Vec<u8>, Self::Error>, bool);
}
Expand description

Code execution engine.

Required Associated Types§

Source

type Error: Display + Debug + Send + Sync + 'static

Externalities error type.

Required Methods§

Source

fn call( &self, ext: &mut dyn Externalities, runtime_code: &RuntimeCode<'_>, method: &str, data: &[u8], context: CallContext, ) -> (Result<Vec<u8>, Self::Error>, bool)

Call a given method in the runtime.

Returns a tuple of the result (either the output data or an execution error) together with a bool, which is true if native execution was used.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

impl<D: NativeExecutionDispatch + 'static> CodeExecutor for NativeElseWasmExecutor<D>

impl<H> CodeExecutor for WasmExecutor<H>
where H: HostFunctions,