pub struct Element { /* private fields */ }Expand description
Element — 树上的一个节点
字段仅在 crate 内可写;外部通过只读 accessor(Element::id /
Element::children / Element::render_object 等)查询,避免绕过
Element/RO 双树不变量直接改树。
Implementations§
Source§impl Element
impl Element
Sourcepub fn widget(&self) -> &WidgetNode
pub fn widget(&self) -> &WidgetNode
当前关联的 widget 配置。
Sourcepub fn render_object(&self) -> &SharedRO
pub fn render_object(&self) -> &SharedRO
Element 持有的共享 RenderObject。
Sourcepub fn state_mut(&mut self) -> Option<&mut dyn State>
pub fn state_mut(&mut self) -> Option<&mut dyn State>
可变 State(仅供 devtools / 测试模拟状态变更;框架内部走 State 生命周期)。
Sourcepub fn state_box_mut(&mut self) -> Option<&mut Box<dyn State>>
pub fn state_box_mut(&mut self) -> Option<&mut Box<dyn State>>
可变 State Box(兼容测试直接 downcast_mut 的用法)。
Sourcepub fn layout_offset(&self) -> Point
pub fn layout_offset(&self) -> Point
本 element 在所属 layer 内的布局偏移。
Sourcepub fn is_inherited(&self) -> bool
pub fn is_inherited(&self) -> bool
是否是 InheritedWidget 节点。
Sourcepub fn subscriber_id(&self) -> SubscriberId
pub fn subscriber_id(&self) -> SubscriberId
响应式订阅者 id。
Auto Trait Implementations§
impl !RefUnwindSafe for Element
impl !Send for Element
impl !Sync for Element
impl !UnwindSafe for Element
impl Freeze for Element
impl Unpin for Element
impl UnsafeUnpin for Element
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