pub trait BuiltinFunctionDefinition<C>where
C: ContextObject,{
type Error: Into<Box<dyn Error>>;
// Required method
fn rust(
vm: &mut C,
arg_a: u64,
arg_b: u64,
arg_c: u64,
arg_d: u64,
arg_e: u64,
) -> Result<u64, Self::Error>;
// Provided methods
fn vm(
vm: EncryptedHostAddressToEbpfVm<C>,
a: u64,
b: u64,
c: u64,
d: u64,
e: u64,
) { ... }
fn codegen(jit: &mut JitCompiler<'_, C>) { ... }
fn register(
program: &mut BuiltinProgram<C>,
name: &str,
) -> Result<(), ElfError>
where Self: Sized { ... }
}Expand description
Native built-in functions that can be made available to programs to call.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn vm(
vm: EncryptedHostAddressToEbpfVm<C>,
a: u64,
b: u64,
c: u64,
d: u64,
e: u64,
)
fn vm( vm: EncryptedHostAddressToEbpfVm<C>, a: u64, b: u64, c: u64, d: u64, e: u64, )
The VM wrapper.
Sourcefn codegen(jit: &mut JitCompiler<'_, C>)
fn codegen(jit: &mut JitCompiler<'_, C>)
Hook for the JIT compiler on how to codegen this built-in function.
You could opt to codegen it in-line, but do note that defining the other methods is still required for non-JIT execution modes.
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.