pub struct SharedRO(/* private fields */);Expand description
共享 RO —— Rc<RoCell>
除 RO 本体的 RefCell 外,还携带布局 dirty/约束缓存,供容器在
layout_cached 中跳过 clean 子树(容器级脏子树裁剪)。
Implementations§
pub fn borrow(&self) -> Ref<'_, Box<dyn RenderObject>>
pub fn borrow_mut(&self) -> RefMut<'_, Box<dyn RenderObject>>
pub fn ptr_eq(&self, other: &SharedRO) -> bool
pub fn mark_layout_dirty(&self)
pub fn is_layout_dirty(&self) -> bool
Sourcepub fn layout_snapshot(&self) -> Option<(BoxConstraints, Size)>
pub fn layout_snapshot(&self) -> Option<(BoxConstraints, Size)>
只读快照:上一次 layout_cached 使用的约束与返回尺寸(从未布局过时为 None)。
供 Inspector 的布局 overlay 展示「这个元素被告知可用多大」; 纯读取,不改 dirty/cache,因此不影响渲染路径。
Sourcepub fn layout_cached(
&self,
constraints: BoxConstraints,
ctx: &mut LayoutContext,
) -> Size
pub fn layout_cached( &self, constraints: BoxConstraints, ctx: &mut LayoutContext, ) -> Size
带缓存的 layout:clean 且约束与上次相同时直接返回上次 size。
Trait Implementations§
Auto Trait Implementations§
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