CallableJitFunction

Struct CallableJitFunction 

Source
pub struct CallableJitFunction<F> { /* private fields */ }
Expand description

A JIT-compiled function that can be called directly

This structure wraps executable machine code and provides type-safe calling methods. While the type parameter F represents a Rust function signature, the actual execution uses C ABI for stability.

§Supported Signatures

Currently supports function signatures with 0-7 arguments:

  • fn() -> R
  • fn(A1) -> R
  • fn(A1, A2) -> R
  • … up to fn(A1, A2, A3, A4, A5, A6, A7) -> R

For unsupported signatures, use RawCallableJitFunction instead.

Implementations§

Source§

impl<F> CallableJitFunction<F>

Source

pub fn new(code: &[u8]) -> Result<Self, JitError>

Create a new callable JIT function from instruction bytes

Source§

impl<R> CallableJitFunction<fn() -> R>

Direct call methods based on function signature

These methods provide type-safe calling with automatic ABI conversion from Rust function types to C ABI. Currently supports 0-7 arguments.

The conversion from fn(...) to extern "C" fn(...) is handled internally for ABI stability across Rust versions.

Source

pub fn call(&self) -> R

Call with no arguments - natural syntax: func.call()

Source§

impl<A1, R> CallableJitFunction<fn(A1) -> R>

Source

pub fn call(&self, arg1: A1) -> R

Call with one argument - natural syntax: func.call(arg)

Source§

impl<A1, A2, R> CallableJitFunction<fn(A1, A2) -> R>

Source

pub fn call(&self, arg1: A1, arg2: A2) -> R

Call with two arguments - natural syntax: func.call(arg1, arg2)

Source§

impl<A1, A2, A3, R> CallableJitFunction<fn(A1, A2, A3) -> R>

Source

pub fn call(&self, arg1: A1, arg2: A2, arg3: A3) -> R

Call with three arguments - natural syntax: func.call(arg1, arg2, arg3)

Source§

impl<A1, A2, A3, A4, R> CallableJitFunction<fn(A1, A2, A3, A4) -> R>

Source

pub fn call(&self, arg1: A1, arg2: A2, arg3: A3, arg4: A4) -> R

Call with four arguments - natural syntax: func.call(arg1, arg2, arg3, arg4)

Source§

impl<A1, A2, A3, A4, A5, R> CallableJitFunction<fn(A1, A2, A3, A4, A5) -> R>

Source

pub fn call(&self, arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) -> R

Call with five arguments

Source§

impl<A1, A2, A3, A4, A5, A6, R> CallableJitFunction<fn(A1, A2, A3, A4, A5, A6) -> R>

Source

pub fn call( &self, arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, arg6: A6, ) -> R

Call with six arguments

Source§

impl<A1, A2, A3, A4, A5, A6, A7, R> CallableJitFunction<fn(A1, A2, A3, A4, A5, A6, A7) -> R>

Source

pub fn call( &self, arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, arg6: A6, arg7: A7, ) -> R

Call with seven arguments

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.