Skip to main content

ElementTree

Struct ElementTree 

Source
pub struct ElementTree {
    pub event_log: EventLog,
    /* private fields */
}
Expand description

Element 树

外部只读查询走 accessor(ElementTree::element / ElementTree::root_id / ElementTree::elements / ElementTree::layer_tree);字段在 crate 内可写, 防止宿主/devtools 绕过树不变量直接改树。

Fields§

§event_log: EventLog

DT-01:事件与焦点日志环形缓冲(本地开关默认开;devtools 总闸打开后才采集)。

Implementations§

Source§

impl ElementTree

Source

pub fn mark_element_dirty(&mut self, element_id: ElementId)

阶段 4-A:把 element 标 dirty,并沿 element 父链向上传播到所属 layer。 嵌套 layer 场景:子 layer dirty → 父 layer 也标 dirty(因为父 layer 的 paint 包含子 layer)。

阶段 4-D 更新:hit_test 现在能命中 layer 内的子 element(button 在 RepaintBoundary 内), 这些子 element 自己的 layer = None,需要沿 element 父链向上找到最近的有 layer 的祖先(RepaintBoundary),再标那个 layer dirty。

标记 element 需要重画(局部 refresh + 本层重排,不触发父层整树重排)。

这是外部的“重绘请求”语义(与事件/动画一致):需要父层重新布局的结构性 变化请走 mark_element_layout_dirty(框架内部 update/rebuild/overlay 路径)。

Source

pub fn mark_all_layers_dirty(&mut self)

阶段 4-A:把所有 layer 标 dirty(update 路径用 — widget 树变化是全量 dirty)

为什么 update 路径不优化:widget 树 diff 不知道哪些 subtree 真的没变, 保守做法是全标 dirty(后续 4-C 可以做“按 subtree 智能 mark dirty“)。

Source§

impl ElementTree

Source

pub fn hit_test(&self, position: Point) -> Option<ElementId>

命中测试:在 position 处找最深的 element

阶段 4-D 更新:走 element tree 递归(每个 element 用自己的 RO + 自己的 layout_offset 作为该 RO 的左上角位置)。

走 element tree 而非单一 root RO 树的原因:

  • root RO 树(widget.create_render_object() 递归创建)与 element 各自 mount 的 RO 是两份独立 RO,root RO 树里 child RO 的 element_id 不会从父 RB propagate 下去(Stack 的 propagate 只到 child slot),嵌套 layer 的子 element 命中不到
  • element tree 里每个 element 自己在 mount 时通过 propagate_element_ids 把 child_id 写到 child RO,递归时各 element 的 RO 状态完整

layout_offset 是该 element 在 root layer 内的 logical offset(从父 element 命中测试:在 position 处找最深的 element

阶段 4-D:走 root_render_object(单一 RO 树,累加 offset 正确,容器 RO 自己递归 children)。

之前改走 element tree 解决了 element_id 缺失,但失去了容器 RO(ListView/Column 等)的累加 y 能力 — 容器 RO 的 children layout_offset 都是 (0, 0),hit_test 累加不到 ListView 累加的 y 位置。

修复 element_id 缺失:在 propagate_element_ids 时总是用 child element.render_object 替换 root RO 树里的 child slot(不论 stateful 与否), 这样 root RO 树里所有叶子 RO 的 element_id 都正确。

阶段 3-13:overlay 优先命中(top-down),命中 overlay 后不再走主树, 体现“浮层盖住下层“语义。

Source

pub fn dispatch_event(&mut self, event: &WidgetEvent, position: Point)

把事件分发给最深的命中 element 对应的 widget(或 state)

阶段 4-A:命中 element 时标 dirty(连同所属 layer + 父 layer 链),让 paint_frame 知道这一帧要重画哪些 layer。

阶段 2 手势系统升级(设计 § 14.4 + § 15.2):

  • PointerDown:hit_test 命中者成为捕获目标;事件沿 Element 树 向上冒泡投递给命中者及所有持有 state 的祖先(祖先的 GestureDetector / 交互控件也能收到;例如点击 Button 的 label, 事件冒泡到 Button)
  • PointerMove/Up:投递给捕获目标链;Up 后释放
  • 竞技场仲裁:投递后查询链上 state 的 gesture_state(), 第一个 Accepted(持续型手势,如拖拽)的 element 独占后续指针 事件,其他手势参与者被 reject_gestures 否决

投递时把全局坐标折算为每个 element 各自的本地坐标 (Slider 等需要按本地位置计算 value)。

Source

pub fn dispatch_event_to(&mut self, id: ElementId, event: &WidgetEvent) -> bool

定向投递事件到指定 element(不经 hit_test)。

供无障碍语义动作使用:平台按 AccessKit NodeId 反查到 ElementId, 直接交给目标控件(TextField/Slider 等),而不是按坐标命中。

返回 false 表示目标不存在或已失活。

Source

pub fn reveal(&mut self, id: ElementId, target_root: Rect) -> bool

无障碍 ScrollIntoView:沿 id 到根的链,把 target_root 折算到每个 祖先的本地坐标并调用 State::scroll_into_view。最近的滚动容器消费后停止。

target_root 是语义树坐标系(root layer 逻辑像素)中的目标矩形。 对虚拟项,id 传宿主元素、target_root 传行/单元格的语义 bounds。

Source

pub fn pointer_leave_window(&mut self)

光标离开窗口 / 窗口失焦:结束 hover、取消进行中的指针交互。

不改变键盘焦点;调用方需要时自行 clear_focus()。

Source

pub fn focused_element(&self) -> Option<ElementId>

当前持有键盘焦点的 element(None = 无焦点)

Source

pub fn request_focus(&mut self, id: ElementId)

请求把键盘焦点移到 id

焦点切换时向旧焦点发 FocusLost、新焦点发 FocusGained (widget/state 据此知道“键盘焦点在这儿“),再补一发 FocusVisibleChanged (环画不画由来路决定:键盘导航画、鼠标点击不画)。两边都标 dirty 触发重绘。

Source

pub fn focus_visible(&self) -> bool

焦点环当前该不该画(给测试与宿主查询)

Source

pub fn clear_focus(&mut self)

清除焦点(窗口失焦 / 焦点 element 被卸载等)

Source§

impl ElementTree

Source

pub fn dispatch_key_event(&mut self, event: &WidgetEvent)

键盘事件入口(runtime 把 winit KeyboardInput 转成 WidgetEvent 后调用)

  • Tab / BackTab(Shift+Tab):焦点链遍历(不发给 widget); 但焦点 widget captures_tab() 为 true 时(编辑器 Tab 缩进)跳过遍历直接投递
  • Esc:有 overlay 时关闭顶层 overlay 并拦截;无 overlay 透传焦点组件
  • 其余 KeyDown/KeyUp:只路由给焦点 element 的 state/widget

焦点 element 已被卸载(deactivate)时,自动清焦并丢弃事件。

Source

pub fn focus_next(&mut self)

焦点移到焦点链的下一个(无焦点 → 第一个;末尾回绕)

Source

pub fn focus_previous(&mut self)

焦点移到焦点链的上一个(无焦点 → 最后一个;开头回绕)

Source

pub fn focused_wants_ime(&self) -> bool

阶段 2-E:焦点 widget 是否要 IME(runtime 据此 set_ime_allowed)

None = 无焦点或焦点 widget 不需要 IME。

Source

pub fn element_origin(&self, id: ElementId) -> Option<Point>

element 的 RO 在 root layer 坐标系下的原点(IME 光标定位 / 无障碍 bounds 用)

布局完成后缓存“element → 绝对 origin”全表(O(N) 一次),之后查询 O(1)。 事件冒泡链上每个节点都会调 local_position,以前每次从 RO 根 DFS, 深链/大树的派发成本是 O(链长 × N)。

局限:Transform 的视觉变换不计入(逻辑坐标,不是屏幕坐标)。

Source

pub fn process_overlay_actions(&mut self, now_ms: u64)

每帧调用(rebuild 之后、paint 之前):统一消费所有 OverlayAware 组件的意图

Source

pub fn close_topmost_overlay(&mut self) -> bool

Esc 关闭顶层 overlay(框架级快捷键,类似 Tab)

只通知被关闭 overlay 的 requester(开启它的组件 state),带上被关闭的 handle。旧实现广播给所有 OverlayAware state,会把同时打开的下层 overlay 状态一起复位(例如 Dialog 下方还开着 Menu 时,Esc 关 Menu 却让 Dialog suppress_show=true)。DialogElementState 收到匹配 handle 后设 suppress_show, 防止 widget.open 还为 true 时被立即重新 show。

返回是否真正关闭了 overlay(false = 无 overlay,调用方可据此决定是否透传事件)。

Source§

impl ElementTree

Source

pub fn set_viewport_size(&mut self, size: Size)

更新 surface 逻辑尺寸(应用在帧首调用;overlay 定位用它做边界约束)

Source§

impl ElementTree

Source

pub fn show_overlay( &mut self, position: Point, widget: WidgetNode, requester_id: Option<ElementId>, ) -> OverlayHandle

显示一个 overlay 子树

  • position:overlay 顶层 layer 在父(root layer)内的 logical offset
  • widget:overlay 的根 widget(独立子树,parent = None)

返回 OverlayHandle 用于 hide_overlay 关闭。

Source

pub fn hide_overlay(&mut self, handle: OverlayHandle)

关闭 overlay(卸载子树 + 释放 layer + 恢复焦点)

找不到 handle 时静默 noop(便于在 widget 析构时安全调用)。

Source

pub fn overlay_count(&self) -> usize

当前显示的 overlay 数量

Source

pub fn debug_overlay_position(&self) -> Option<(Point, Size)>

debug/测试:返回最近一个 overlay 的当前 layer offset 和根 RO 的 content_size

Source

pub fn overlay_root(&self, handle: OverlayHandle) -> Option<ElementId>

测试辅助:取得指定 overlay 的根 element id

Source

pub fn debug_overlay_root(&self) -> Option<ElementId>

debug/测试:最近一个 overlay 的根 element id(Update 是否复用 State 的判据)

Source§

impl ElementTree

Source

pub fn process_overlay_intents(&mut self, now_ms: u64)

通用 overlay 意图循环:遍历所有 Overlay-aware state,收集意图,先 Hide 后 Show 执行

Source

pub fn position_overlay_after_mount( &mut self, handle: OverlayHandle, target_rect: Rect, placement: TooltipPlacement, gap: f32, offset: Point, )

mount overlay 后,手动 layout overlay root RO 拿真实布局尺寸, 再根据 placement + target_rect + bubble_size + gap + offset 修正 layer offset

Source

pub fn clamp_overlay_after_mount(&mut self, handle: OverlayHandle)

Point-anchored overlay 的窗口边界 clamp(需要先 layout 拿真实尺寸)

Source§

impl ElementTree

Source

pub fn notify_inherited_changed(&mut self, inherited_eid: ElementId)

阶段 4-A:InheritedWidget 数据变化时由 update 路径调,通知所有 dependents dirty。

递归:dependents 自己也可能依赖其他 InheritedWidget,所以 broadcast 后被标 dirty 的 element rebuild 时如果又调 depend_on,可能触发“二次通知“ — 这里简单做法:每个 dependent 标 dirty + 加入 dirty set,rebuild_tree 时按 dirty set 重建,完成。

不通知祖辈:InheritedElement 的数据变化不会让祖辈 rebuild(他们不依赖 自己的后代),这里单向通知。

Source

pub fn update_inherited_element( &mut self, element_id: ElementId, new_widget: WidgetNode, ) -> bool

手动更新一个 InheritedElement 的 widget,并根据 update_should_notify 决定 是否通知所有 dependents。

与 reuse_element 的区别:不重建 RO 也不 diff 子节点,只更新 widget + 通知 dependents。适合纯数据更新场景(Theme / Direction 切换)。

返回值:

  • true:成功替换 widget,dependents 被标 dirty
  • false:element_id 不存在、不是 InheritedElement,或 update_should_notify 返回 false(说明新旧数据等价,无需通知)
Source

pub fn set_theme(&mut self, new_theme: ThemeData) -> bool

便捷方法 — 找到第一个 ThemeWidget 类型的 InheritedElement 并更新 theme。 保持 direction 和 child 不变,只替换 ThemeData。

返回 true 表示找到了 ThemeWidget 且 theme 有实质变化(触发了 dependents 通知);false 表示树中没有 ThemeWidget 或新主题与旧主题等价。

Source

pub fn set_direction(&mut self, new_dir: Direction) -> bool

便捷方法 — 找到第一个 DirectionWidget 类型的 InheritedElement 并更新 direction。

Source

pub fn tick_states(&mut self, root: ElementId, now_ms: u64) -> bool

阶段 3-16:每帧 paint 前对 root 子树所有 stateful element 的 state 跑一次 tick()。

post-order 递归:children 先 tick,parent 后 tick — 这样父 state 若依赖子 state 的本帧收敛值,也能拿到最新值。

用途:让 state 内的“目标值 → 实际值“lerp 在每帧 paint 前推进一帧 (如 ListView 的 target_scroll_offset → scroll_offset 平滑收敛)。 runtime 在 about_to_wait 帧入口调一次即可,paint_frame 内部不再调。

关键:tick() 改了 state 后必须 mark element dirty —— 否则 paint_layer_recursive 走 is_dirty == false 路径复用 cached_paint_list,新值永远看不到。 这是 ListView 滚动“卡住“的根因。

返回值 bool:任一 stateful element 处于“动画进行中“(is_animating()) 则返回 true。runtime 据此决定是否 request_redraw —— 静止后所有 state 都收敛, 整棵树不再 mark_dirty + paint,消除“静止时持续重画导致停顿“。 这也是“连续滑动时不时停顿“的根因:静止后 layer 仍 dirty,每帧 paint

  • GPU surface 抢资源。

没有 state 的 element 直接跳过(no-op)。stateful element 调 state.tick(), 若 is_animating() == true 才 mark dirty(收敛后不再 mark,触发 paint 复用 cached,零开销)。

Source

pub fn tick_all_states(&mut self, now_ms: u64) -> bool

覆盖主树 root + 所有 overlay root_element 的统一入口。

之前只对主树 root 调 tick_states → overlay 内的 ScrollView/ListView 等 有 lerp/tick 的组件完全不被 tick → scroll_offset 永远是 mount 时的初始值 (通常 = 0) → 用户看到内容“滚不动“ —— 滚轮事件改变了 target_scroll_offset 但 tick 不 lerp,RO scroll_offset 从不更新,paint 永远显示 mount 时画面。

返回:true = 任一 stateful element(主树或 overlay)仍在动画中, runtime 据此 request_redraw 保持下一帧继续 tick。

性能:遍历有状态元素注册表(create_state_for 登记而非全树递归, O(有状态数) vs O(全树));过期项(已卸载/进池/state 已释放)在遍历前 惰性压缩剔除。原 tick_states 全树后序遍历每节点要 clone children Vec, 编辑器页 500+ 元素时每帧 ~15ms(debug),注册表后降到 ~1ms。

Source

pub fn next_animation_delay(&self, now_ms: u64) -> Option<u64>

所有 active stateful element 中最早的下一次 tick 延迟(毫秒)。

Source

pub fn poll_needs_build(&mut self)

只轮询 take_needs_build()(不推进动画时钟),把重建请求入队。

手势竞技场独占时,事件只投递给 winner,持有 dirty 标志的祖先 State (如包裹 Dock 的模型层)不会收到事件、take_needs_build 也就不会被 查询。帧首调用本方法兜底消费这些重建请求。

Source

pub fn find_by_widget_type<T: 'static>(&self) -> Option<ElementId>

按 Widget 具体类型找第一个 active element(焦点移交/归还、测试断言)

Source

pub fn find_in_subtree<T: 'static>(&self, root: ElementId) -> Option<ElementId>

在 root 子树内按 Widget 具体类型找第一个 active element(DFS)

Source

pub fn len(&self) -> usize

Element 数量(活跃)

Source

pub fn is_empty(&self) -> bool

是否空

Source

pub fn total_len(&self) -> usize

全部 Element 数(含 Inactive)

Source

pub fn inactive_len(&self) -> usize

Inactive 池内的 Element 总数(多槽池)

Source

pub fn get(&self, id: ElementId) -> Option<&Element>

拿到指定 element 的引用

Source

pub fn get_mut(&mut self, id: ElementId) -> Option<&mut Element>

拿到指定 element 的可变引用

Source

pub fn subscriber_ids(&self) -> Vec<SubscriberId>

收集所有 subscriber_id(测试用,只含 active)

Source

pub fn dump_widget_tree(&self) -> String

调试:递归 dump active element 树为可读字符串。

输出示例:

root(StackWidget) size=800x600 dirty=false
├─ FlexWidget(Column) offset=(48,132)
│  ├─ ButtonWidget [stateful]
│  └─ ButtonWidget [stateful]
└─ ListViewWidget(count=100) visible=[5..12] dirty=true
Source§

impl ElementTree

Source

pub fn new() -> Self

Source

pub fn mount(&mut self, root: WidgetNode)

第一次 mount:空树上挂一个 root widget

Source

pub fn remount(&mut self, new_root: WidgetNode)

重新 mount:丢弃旧树,挂新 root(无 diff)

阶段 3 仍保留这条逃生通道(测试和冷启动场景用)

Source

pub fn update(&mut self, new_widget: WidgetNode) -> ElementId

用 new_widget 更新根节点(diff 路径)

返回新的根 element_id(同 type 复用时 id 不变)

阶段 4-A:update 路径下保守地 mark all layers dirty(widget 树 diff 不能 精确知道哪些 subtree 没变,所以全标 dirty;event 路径才走精确的局部 dirty)。

Source

pub fn has_build_requests(&self) -> bool

是否有等待消费的 children 重建请求(供宿主在 AboutToWait 里决定是否续帧)。

Source

pub fn process_build_requests(&mut self)

帧首统一处理 State 的 children 重建请求(事件路径入队,见 deliver_event)。

为什么不在 handle_event 里立即重建:事件 dispatch 正在遍历 hit 链,原地 mount/deactivate 子树会让迭代失效;且重建后要走标准 dirty → refresh → layout → paint 流程,paint_frame 开头是唯一天然时机。

复用 update 路径的 reuse_element:把同一 widget set_widget 回去(prop 未变, 组件的 adopt-on-prop-change 逻辑不会误重置 state),state.build() 拿新 children → diff 子树 → RO/element_id 重新同步。

公开:宿主在 tick 之后、焦点移交等依赖新 children 的操作之前可主动调用 (否则要等到下一帧 paint_frame 才消费,焦点请求会晚一帧)。

Source

pub fn take_any_signal_rebuild(&mut self) -> bool

本树自上次消费以来是否有 peek 信号变化(按全局 epoch,多窗口互不吞)。

Source

pub fn drain_scoped_signal_dirty(&mut self) -> usize

排空本树的 Signal dirty(不含宿主 peek 的全局 fallback),转成 element dirty。

与 drain_signal_dirty 的区别:不消费 ANY_SIGNAL_SET,命中元素会记入 signal_dirty_elements,供 rebuild_signal_dirty 选择性重建。

Source

pub fn drain_signal_dirty(&mut self) -> usize

阶段 5-G 公共方法:排空 Signal dirty 集合,转成 element dirty。

兼容入口:包含宿主 peek 触发的全局 fallback(计数 +1)。 需要选择性重建的宿主应改用 drain_scoped_signal_dirty + rebuild_signal_dirty。

Source

pub fn rebuild_signal_dirty(&mut self) -> usize

只重建本轮 Signal dirty 命中的 element(State::build → children diff)。

适用于“组件 state 在 build 里读 Signal”的场景:父级 widget props 未变, 无需全树 update。宿主以 peek 读取的应用级信号仍应走全树 rebuild。 返回实际重建的 element 数。

Source§

impl ElementTree

Source

pub fn root_render_object(&self) -> Option<SharedRO>

拿到根 RO 的 SharedRO(Rc clone,与 ElementTree 完全解耦)

✅ Rc<RefCell<>> 后,不再需要 &mut self — Rc clone 和 tree borrow 完全解耦, 调用方拿到后自己 .borrow()/.borrow_mut(),可以同时调其他 &mut self 方法。

之前返回 Ref<‘, dyn RO> / RefMut<’, dyn RO> 会锁住 tree, 测试代码里持有 RO 期间再调 dispatch_event 会 E0499 借用冲突。

Source

pub fn build_accessibility_tree(&self) -> Vec<(ElementId, SemanticsData)>

遍历所有 active Element,收集语义快照 + layout bounds + children 结构。

返回 Vec<(ElementId, SemanticsData)>:

  • 每个有语义声明的 element 产生一个条目(State 优先,其次 Widget)
  • bounds 是逻辑像素(runtime 乘 DPR 送 AccessKit)
  • 必须在 layout 之后调用(content_size 和 element_origin 才有意义)

树形结构:

  • 主树与各 overlay 是平行森林,统一挂到合成根 ElementId::A11Y_ROOT 下(AccessKit 要求单根)
  • children 不是原始 element children,而是最近的语义后代 — 纯视觉包装层(Stack/Row/GestureDetector)被跳过并“提升“其语义子节点, 否则 runtime 按 id 过滤后会出现孤立的语义节点
  • inactive / 不可见分支(IndexedStack hidden 页)整棵跳过
Source§

impl ElementTree

Source

pub fn root_id(&self) -> Option<ElementId>

当前 root element id(空树为 None)。

Source

pub fn element(&self, id: ElementId) -> Option<&Element>

按 id 查询活动/池中的 element(只读)。

Source

pub fn elements(&self) -> impl Iterator<Item = (ElementId, &Element)> + '_

遍历所有 element(含 Inactive 池;用 Element::is_active 过滤)。

Source

pub fn element_count(&self) -> usize

element 总数(含 Inactive 池)。

Source

pub fn layer_tree(&self) -> &LayerTree

Layer 树(只读)。

Source

pub fn text_measurer(&self) -> Option<TextMeasurer>

当前注入的文字测量回调。

Source

pub fn set_text_measurer(&mut self, measurer: Option<TextMeasurer>)

注入文字测量回调(core 不依赖字体实现)。

Source

pub fn audit_render_protocol(&self) -> Vec<String>

P1-7 诊断:检查 element 树与 RO 树的直接 child 对应关系。

对每个 active element 检查两件事:

  1. 其直接 child 的 SharedRO 是否在自身 RO 子树中恰好出现一次;
  2. 自身 RO 的直接子 RO 数是否超过 element 树的直接 child 数 (多出来的就是 widget/state 在 create_render_object 里自造的“影子 RO”: element 树不知道它 → 永远不 mount → 该子树不渲染、不收事件、state 失效。 State::build() 必须返回这些 children,让框架挂 element 后再由 propagate_element_ids 把 slot 换成 element 自己的 RO —— ScrollView/ SplitPane 都踩过这条)。

直接子 RO 数取 for_each_child(所有容器 RO 都必须实现,比 children_count 可靠),返回问题列表(空 = 一致);复杂度 O(元素数 × RO 子树), 只应在 debug / 测试 / Inspector 中调用。

Source

pub fn semantics_revision(&self) -> u64

语义树版本(mount/update/dirty/overlay/focus 变化时自增)。

Host 仅在版本变化时重建 a11y 快照,避免动画/角标帧每帧全量遍历。

Source

pub fn last_layout_ns(&self) -> u64

最近一帧 paint_frame 的布局耗时(纳秒,供 profile/Inspector)。

Source

pub fn last_paint_ns(&self) -> u64

最近一帧 paint_frame 的绘制收集/合批耗时(纳秒)。

Source§

impl ElementTree

Source

pub fn inspect_elements(&self, limit: usize) -> Vec<ElementInfo>

按树序快照最多 limit 个 active element(深度优先,父在前)。

Source

pub fn inspect_counts(&self) -> (usize, usize)

(active element 数, 总 element 数)

Source

pub fn inspect_layers(&self) -> Vec<LayerInfo>

所有真实 layer(不含虚拟 root),按 z_order 升序。

Source

pub fn element_bounds(&self, id: ElementId) -> Option<Rect>

element 在 root layer 逻辑坐标下的 bounds(origin + RO content_size)。

容器 RO 若不实现 content_size(返回 ZERO),bounds 会是零尺寸; Inspector 会显示 origin + “0×0”。

Source

pub fn element_detail(&self, id: ElementId) -> Option<ElementDetail>

单个 element 的拾取详情(bounds + 布局约束 + 焦点态)。

id 不存在或已非 active 时返回 None;纯只读,不触发 layout/paint。

Source

pub fn hit_test_detail(&self, position: Point) -> Option<ElementDetail>

窗口坐标 → 最深命中元素的拾取详情(Inspector 元素拾取入口)。

与事件路由共用 ElementTree::hit_test(含 overlay 优先与 RO 命中), 因此拾取高亮的就是实际点击目标;只读,不改变捕获或焦点。

Source§

impl ElementTree

Source

pub fn inspect_signal_trace(&self, max: usize) -> Vec<SignalEventView>

DT-02:取最近 N 条 Signal trace 并把 subscriber 映射到本树 ElementId。

Source

pub fn inspect_signal_dirty(&self) -> Vec<SignalDirtyView>

DT-02:枚举本树所有 registered subscriber(通过 subscriber_to_element) 并标记哪些当前处于 dirty 状态。

Trait Implementations§

Source§

impl Default for ElementTree

Source§

fn default() -> Self

Returns the “default value” for a type. 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.