Struct OnionLambdaRunnableLauncher

Source
pub struct OnionLambdaRunnableLauncher { /* private fields */ }

Implementations§

Source§

impl OnionLambdaRunnableLauncher

Source

pub fn new_static<F>( lambda_obj: &OnionStaticObject, argument_tuple_obj: &OnionStaticObject, runnable_mapper: &'static F, ) -> Result<OnionLambdaRunnableLauncher, RuntimeError>
where F: Fn(Box<dyn Runnable>) -> Result<Box<dyn Runnable>, RuntimeError> + Sync + Send + 'static,

Trait Implementations§

Source§

impl Runnable for OnionLambdaRunnableLauncher

Source§

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

执行 Lambda 启动器的下一步操作。

此方法通过一个状态机来处理参数的收集、验证(通过约束)并最终启动 Lambda。 它的主要职责是:

  1. 如果存在参数约束 (constrain_runnable),则先执行约束。
  2. 根据当前的 phase(命名参数、位置参数、完成)处理传入的参数。
  3. 收集和整理参数,直到所有参数处理完毕。
  4. 创建并返回目标 Lambda 的可运行实例。
§参数
  • gc: 垃圾收集器的可变引用,用于内存管理。
§返回
  • Ok(StepResult): 表示操作成功,并指示调度器下一步应该做什么。
    • StepResult::Continue: 表示启动器需要更多步骤来完成参数处理或约束执行。
    • StepResult::ReplaceRunnable: 表示参数处理完成,启动器应被新的 Lambda 可运行实例替换。
  • Err(RuntimeError): 表示在执行过程中发生错误。
Source§

fn copy(&self) -> Box<dyn Runnable>

Source§

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

Source§

fn format_context(&self) -> Result<Value, RuntimeError>

Source§

fn copy_with_gc(&self, gc: &mut GC<OnionObjectCell>) -> Box<dyn Runnable>

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.