fret_ui/tree/debug/
view_cache.rs1use super::super::*;
2
3#[derive(Debug, Clone, Copy)]
4pub struct UiDebugCacheRootStats {
5 pub root: NodeId,
6 pub element: Option<GlobalElementId>,
7 pub reused: bool,
8 pub contained_layout: bool,
9 pub paint_replayed_ops: u32,
10 pub reuse_reason: UiDebugCacheRootReuseReason,
11}
12
13#[derive(Debug, Clone, Copy, PartialEq, Eq)]
14pub enum UiDebugCacheRootReuseReason {
15 FirstMount,
16 NodeRecreated,
17 MarkedReuseRoot,
18 ViewCacheDisabled,
20 InspectionActive,
22 NotMarkedReuseRoot,
23 CacheKeyMismatch,
24 NeedsRerender,
25 LayoutInvalidated,
26 ManualCacheRoot,
27}
28
29impl UiDebugCacheRootReuseReason {
30 pub fn as_str(self) -> &'static str {
31 match self {
32 Self::FirstMount => "first_mount",
33 Self::NodeRecreated => "node_recreated",
34 Self::MarkedReuseRoot => "marked_reuse_root",
35 Self::ViewCacheDisabled => "view_cache_disabled",
36 Self::InspectionActive => "inspection_active",
37 Self::NotMarkedReuseRoot => "not_marked_reuse_root",
38 Self::CacheKeyMismatch => "cache_key_mismatch",
39 Self::NeedsRerender => "needs_rerender",
40 Self::LayoutInvalidated => "layout_invalidated",
41 Self::ManualCacheRoot => "manual_cache_root",
42 }
43 }
44}
45
46#[derive(Debug, Clone, Copy)]
47pub(in crate::tree) struct DebugViewCacheRootRecord {
48 pub(in crate::tree) root: NodeId,
49 pub(in crate::tree) reused: bool,
50 pub(in crate::tree) contained_layout: bool,
51 pub(in crate::tree) reuse_reason: UiDebugCacheRootReuseReason,
52}