pub trait CodeExecutor:
Sized
+ Send
+ Sync
+ ReadRuntimeVersion
+ Clone
+ 'static {
type Error: Display + Debug + Send + Sync + 'static;
// Required methods
fn call(
&self,
ext: &mut dyn Externalities,
runtime_code: &RuntimeCode<'_>,
method: &str,
data: &[u8],
context: CallContext,
) -> (Result<Vec<u8>, Self::Error>, bool);
fn call_with_execution_timeout(
&self,
ext: &mut dyn Externalities,
runtime_code: &RuntimeCode<'_>,
method: &str,
data: &[u8],
context: CallContext,
timeout: Duration,
) -> Result<Vec<u8>, Self::Error>;
}Expand description
Code execution engine.
Required Associated Types§
Required Methods§
Sourcefn call(
&self,
ext: &mut dyn Externalities,
runtime_code: &RuntimeCode<'_>,
method: &str,
data: &[u8],
context: CallContext,
) -> (Result<Vec<u8>, Self::Error>, bool)
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.
Sourcefn call_with_execution_timeout(
&self,
ext: &mut dyn Externalities,
runtime_code: &RuntimeCode<'_>,
method: &str,
data: &[u8],
context: CallContext,
timeout: Duration,
) -> Result<Vec<u8>, Self::Error>
fn call_with_execution_timeout( &self, ext: &mut dyn Externalities, runtime_code: &RuntimeCode<'_>, method: &str, data: &[u8], context: CallContext, timeout: Duration, ) -> Result<Vec<u8>, Self::Error>
Call a given method in the runtime, interrupting execution once timeout has elapsed.
Returns the result: either the output data or an execution error, including one indicating that the timeout has been reached.
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.