pub trait LayoutExt: Layout {
// Provided methods
fn id(&self) -> WidgetId { ... }
fn eq_id<T>(&self, rhs: T) -> bool
where WidgetId: PartialEq<T> { ... }
fn identify(&self) -> IdentifyWidget<'_> { ... }
fn is_ancestor_of(&self, id: &WidgetId) -> bool { ... }
fn is_strict_ancestor_of(&self, id: &WidgetId) -> bool { ... }
fn for_children(&self, f: impl FnMut(&dyn Layout)) { ... }
fn for_children_try<E>(
&self,
f: impl FnMut(&dyn Layout) -> Result<(), E>
) -> Result<(), E> { ... }
fn find_widget(&self, id: &WidgetId) -> Option<&dyn Layout> { ... }
}Expand description
Extension trait over widgets
Provided Methods§
sourcefn id(&self) -> WidgetId
fn id(&self) -> WidgetId
Get the widget’s identifier
Note that the default-constructed WidgetId is invalid: any
operations on this value will cause a panic. Valid identifiers are
assigned during configure.
sourcefn eq_id<T>(&self, rhs: T) -> boolwhere
WidgetId: PartialEq<T>,
fn eq_id<T>(&self, rhs: T) -> boolwhere WidgetId: PartialEq<T>,
Test widget identifier for equality
This method may be used to test against WidgetId, Option<WidgetId>
and Option<&WidgetId>.
sourcefn identify(&self) -> IdentifyWidget<'_>
fn identify(&self) -> IdentifyWidget<'_>
Display as “StructName#WidgetId”
sourcefn is_ancestor_of(&self, id: &WidgetId) -> bool
fn is_ancestor_of(&self, id: &WidgetId) -> bool
Check whether id is self or a descendant
This function assumes that id is a valid widget.
sourcefn is_strict_ancestor_of(&self, id: &WidgetId) -> bool
fn is_strict_ancestor_of(&self, id: &WidgetId) -> bool
Check whether id is not self and is a descendant
This function assumes that id is a valid widget.
sourcefn for_children(&self, f: impl FnMut(&dyn Layout))
fn for_children(&self, f: impl FnMut(&dyn Layout))
Run a closure on all children
sourcefn for_children_try<E>(
&self,
f: impl FnMut(&dyn Layout) -> Result<(), E>
) -> Result<(), E>
fn for_children_try<E>( &self, f: impl FnMut(&dyn Layout) -> Result<(), E> ) -> Result<(), E>
Run a fallible closure on all children
Returns early in case of error.
sourcefn find_widget(&self, id: &WidgetId) -> Option<&dyn Layout>
fn find_widget(&self, id: &WidgetId) -> Option<&dyn Layout>
Find the descendant with this id, if any
Since id represents a path, this operation is normally O(d) where
d is the depth of the path (depending on widget implementations).