Skip to main content

NativeFunctionGenerator

Struct NativeFunctionGenerator 

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

原生函数生成器:将 Rust 函数包装为 VM 可执行的 Runnable。

封装原生 Rust 函数,使其能在 Onion VM 中作为 Lambda 执行。 保存捕获的参数和函数引用,在 VM 调用时执行原生逻辑。

Trait Implementations§

Source§

impl<F> Runnable for NativeFunctionGenerator<F>

Source§

fn step(&mut self, gc: &mut GC<OnionObjectCell>) -> StepResult

执行原生函数,返回计算结果。

Source§

fn format_context(&self) -> String

格式化执行上下文信息,用于调试和错误报告。

Source§

fn receive( &mut self, step_result: &StepResult, gc: &mut GC<OnionObjectCell>, ) -> Result<(), RuntimeError>

接收子任务的结果。 Read more

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.