pub struct NativeFunctionGenerator<F>where
F: Fn(&OnionFastMap<Box<str>, OnionStaticObject>, &mut GC<OnionObjectCell>) -> Result<OnionStaticObject, RuntimeError>,{ /* private fields */ }Expand description
原生函数生成器:将 Rust 函数包装为 VM 可执行的 Runnable。
封装原生 Rust 函数,使其能在 Onion VM 中作为 Lambda 执行。 保存捕获的参数和函数引用,在 VM 调用时执行原生逻辑。
Trait Implementations§
Source§impl<F> Runnable for NativeFunctionGenerator<F>where
F: Fn(&OnionFastMap<Box<str>, OnionStaticObject>, &mut GC<OnionObjectCell>) -> Result<OnionStaticObject, RuntimeError> + Send + Sync + 'static,
impl<F> Runnable for NativeFunctionGenerator<F>where
F: Fn(&OnionFastMap<Box<str>, OnionStaticObject>, &mut GC<OnionObjectCell>) -> Result<OnionStaticObject, RuntimeError> + Send + Sync + 'static,
Source§fn step(&mut self, gc: &mut GC<OnionObjectCell>) -> StepResult
fn step(&mut self, gc: &mut GC<OnionObjectCell>) -> StepResult
执行原生函数,返回计算结果。
Source§fn format_context(&self) -> String
fn format_context(&self) -> String
格式化执行上下文信息,用于调试和错误报告。
Source§fn receive(
&mut self,
step_result: &StepResult,
gc: &mut GC<OnionObjectCell>,
) -> Result<(), RuntimeError>
fn receive( &mut self, step_result: &StepResult, gc: &mut GC<OnionObjectCell>, ) -> Result<(), RuntimeError>
接收子任务的结果。 Read more
Auto Trait Implementations§
impl<F> !RefUnwindSafe for NativeFunctionGenerator<F>
impl<F> !UnwindSafe for NativeFunctionGenerator<F>
impl<F> Freeze for NativeFunctionGenerator<F>
impl<F> Send for NativeFunctionGenerator<F>
impl<F> Sync for NativeFunctionGenerator<F>
impl<F> Unpin for NativeFunctionGenerator<F>
impl<F> UnsafeUnpin for NativeFunctionGenerator<F>where
Arc<F>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more