pub trait ComponentElement: Element {
// Required methods
fn component_data(self: Handle<Self>, app: &App) -> &ComponentElementData;
fn component_data_mut(
self: Handle<Self>,
app: &mut App,
) -> &mut ComponentElementData;
fn build(self: Handle<Self>, app: &mut App) -> WidgetRef;
// Provided methods
fn build_tracked(self: Handle<Self>, app: &mut App) -> WidgetRef { ... }
fn child(self: Handle<Self>, app: &App) -> Option<AnyElement> { ... }
fn mount(
self: Handle<Self>,
app: &mut App,
parent: Option<AnyElement>,
new_slot: Option<Slot>,
) { ... }
fn first_build(self: Handle<Self>, app: &mut App) { ... }
fn perform_rebuild(self: Handle<Self>, app: &mut App) { ... }
fn visit_children_component(
self: Handle<Self>,
app: &App,
visitor: &mut dyn FnMut(AnyElement),
) { ... }
fn forget_child(self: Handle<Self>, app: &mut App, child: AnyElement) { ... }
}Expand description
An Element that composes other Elements.
Rather than creating a RenderObject directly, a ComponentElement creates
RenderObjects indirectly by creating other Elements.
Contrast with RenderObjectElement.
Required Methods§
Sourcefn component_data(self: Handle<Self>, app: &App) -> &ComponentElementData
fn component_data(self: Handle<Self>, app: &App) -> &ComponentElementData
The child slot and build flag, held under the field component.
Sourcefn component_data_mut(
self: Handle<Self>,
app: &mut App,
) -> &mut ComponentElementData
fn component_data_mut( self: Handle<Self>, app: &mut App, ) -> &mut ComponentElementData
See component_data.
Provided Methods§
Sourcefn build_tracked(self: Handle<Self>, app: &mut App) -> WidgetRef
fn build_tracked(self: Handle<Self>, app: &mut App) -> WidgetRef
Runs build inside App::entity_track and binds watches.
Sourcefn child(self: Handle<Self>, app: &App) -> Option<AnyElement>
fn child(self: Handle<Self>, app: &App) -> Option<AnyElement>
The child this element built, if any.
Sourcefn mount(
self: Handle<Self>,
app: &mut App,
parent: Option<AnyElement>,
new_slot: Option<Slot>,
)
fn mount( self: Handle<Self>, app: &mut App, parent: Option<AnyElement>, new_slot: Option<Slot>, )
ComponentElement.mount: the base mount, then the first build.
Sourcefn first_build(self: Handle<Self>, app: &mut App)
fn first_build(self: Handle<Self>, app: &mut App)
ComponentElement._firstBuild.
Sourcefn perform_rebuild(self: Handle<Self>, app: &mut App)
fn perform_rebuild(self: Handle<Self>, app: &mut App)
Calls the build method and then updates the widget tree.
Called automatically during ComponentElement::mount to generate the
first build, and by rebuild when the element needs updating.
Sourcefn visit_children_component(
self: Handle<Self>,
app: &App,
visitor: &mut dyn FnMut(AnyElement),
)
fn visit_children_component( self: Handle<Self>, app: &App, visitor: &mut dyn FnMut(AnyElement), )
ComponentElement.visitChildren.
Sourcefn forget_child(self: Handle<Self>, app: &mut App, child: AnyElement)
fn forget_child(self: Handle<Self>, app: &mut App, child: AnyElement)
ComponentElement.forgetChild.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".