pub struct OnionLambdaRunnableLauncher { /* private fields */ }Expand description
Lambda 启动器。
负责将 Lambda 对象与参数、约束、捕获等进行动态绑定, 并自动处理参数展开、约束检查、runnable 构造与映射等复杂流程。
§字段说明
lambda:被调用的 Lambda 对象(OnionObject::Lambda)lambda_ref:Lambda 定义的强引用lambda_self_object:Lambda 的 self 对象argument:原始参数对象(用于参数展开)flatten_argument:展平后的参数列表string_pool:参数名字符串池,保证参数名唯一性与高效查找current_argument_index:当前参数处理进度runnable_mapper:对生成的 runnable 进行包装/变换的回调
Implementations§
Source§impl OnionLambdaRunnableLauncher
impl OnionLambdaRunnableLauncher
Sourcepub fn new<F>(
lambda: &OnionObject,
argument: OnionStaticObject,
runnable_mapper: F,
) -> Result<OnionLambdaRunnableLauncher, RuntimeError>
pub fn new<F>( lambda: &OnionObject, argument: OnionStaticObject, runnable_mapper: F, ) -> Result<OnionLambdaRunnableLauncher, RuntimeError>
Trait Implementations§
Source§impl Runnable for OnionLambdaRunnableLauncher
impl Runnable for OnionLambdaRunnableLauncher
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>
接收子任务的执行结果。
- StepResult::Continue:参数约束校验通过,继续
- StepResult::Return:布尔约束校验,false 则报错
- 其他类型(NewRunnable/ReplaceRunnable/SpawnRunnable):均为非法,直接报错
- StepResult::Error:直接转发错误
Source§fn step(&mut self, gc: &mut GC<OnionObjectCell>) -> StepResult
fn step(&mut self, gc: &mut GC<OnionObjectCell>) -> StepResult
推进参数约束校验与 runnable 构造。
- 首先依次校验所有参数约束(布尔/嵌套 Lambda)
- 若为布尔约束且为 false,立即报错
- 若为 Lambda 约束,递归生成新 Launcher 进行校验
- 其他类型直接报错
- 所有约束校验通过后,收集参数,调用 lambda_ref.create_runnable 构造 runnable
- 通过 runnable_mapper 包装后,替换当前 runnable
Source§fn format_context(&self) -> String
fn format_context(&self) -> String
格式化当前 Launcher 的上下文信息。
输出当前参数处理进度、Lambda 信息等,便于调试。
Auto Trait Implementations§
impl !RefUnwindSafe for OnionLambdaRunnableLauncher
impl !UnwindSafe for OnionLambdaRunnableLauncher
impl Freeze for OnionLambdaRunnableLauncher
impl Send for OnionLambdaRunnableLauncher
impl Sync for OnionLambdaRunnableLauncher
impl Unpin for OnionLambdaRunnableLauncher
impl UnsafeUnpin for OnionLambdaRunnableLauncher
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