pub struct Mapping { /* private fields */ }Expand description
表示一次 map 操作的调度状态。
container:待映射的容器对象(通常为元组)mapper:映射器函数对象(lambda 或其他)collected:已收集的映射结果current_index:当前处理到的元素索引
Implementations§
Source§impl Mapping
impl Mapping
Sourcepub fn new(container: &OnionStaticObject, mapper: &OnionStaticObject) -> Self
pub fn new(container: &OnionStaticObject, mapper: &OnionStaticObject) -> Self
Trait Implementations§
Source§impl Runnable for Mapping
impl Runnable for Mapping
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>
Source§fn step(&mut self, _gc: &mut GC<OnionObjectCell>) -> StepResult
fn step(&mut self, _gc: &mut GC<OnionObjectCell>) -> StepResult
执行 map 操作的一个调度步骤。
- 若当前元素存在,尝试用 mapper 处理之:
- 若 mapper 是 lambda,则生成新 Runnable 进行调用
- 若 mapper 为 false,跳过当前元素
- 其他情况直接收集元素
- 若所有元素处理完毕,返回收集到的新元组
§返回值
- StepResult::NewRunnable - 需要调度新任务
- StepResult::Continue - 继续下一个元素
- StepResult::Return - 所有元素处理完毕,返回结果
- StepResult::Error - 类型错误或其他异常
Source§fn format_context(&self) -> String
fn format_context(&self) -> String
Auto Trait Implementations§
impl !RefUnwindSafe for Mapping
impl !UnwindSafe for Mapping
impl Freeze for Mapping
impl Send for Mapping
impl Sync for Mapping
impl Unpin for Mapping
impl UnsafeUnpin for Mapping
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