pub trait RenderObjectWithLayoutCallbackMixin: RenderBox {
// Required methods
fn layout_callback_data(
self: RenderHandle<Self>,
app: &App,
) -> &RenderObjectWithLayoutCallbackData;
fn layout_callback_data_mut(
self: RenderHandle<Self>,
app: &mut App,
) -> &mut RenderObjectWithLayoutCallbackData;
fn layout_callback(self: RenderHandle<Self>, app: &mut App);
// Provided methods
fn run_layout_callback(self: RenderHandle<Self>, app: &mut App) { ... }
fn schedule_layout_callback(self: RenderHandle<Self>, app: &mut App) { ... }
}Expand description
A mixin for RenderObjects that run a layout callback (typically one that builds a
widget subtree) during perform_layout, as LayoutBuilder’s render object does.
Implementers keep the bag under a field named layout_callback, implement
layout_callback, and call
run_layout_callback in their perform_layout. The mixin
is on the box protocol here because scheduling needs the tree methods.
Required Methods§
Sourcefn layout_callback_data(
self: RenderHandle<Self>,
app: &App,
) -> &RenderObjectWithLayoutCallbackData
fn layout_callback_data( self: RenderHandle<Self>, app: &App, ) -> &RenderObjectWithLayoutCallbackData
The mixin’s bag.
Sourcefn layout_callback_data_mut(
self: RenderHandle<Self>,
app: &mut App,
) -> &mut RenderObjectWithLayoutCallbackData
fn layout_callback_data_mut( self: RenderHandle<Self>, app: &mut App, ) -> &mut RenderObjectWithLayoutCallbackData
See layout_callback_data.
Sourcefn layout_callback(self: RenderHandle<Self>, app: &mut App)
fn layout_callback(self: RenderHandle<Self>, app: &mut App)
The layout callback to run in perform_layout, through
run_layout_callback, which invokes it with
AnyRenderObject::invoke_layout_callback.
Provided Methods§
Sourcefn run_layout_callback(self: RenderHandle<Self>, app: &mut App)
fn run_layout_callback(self: RenderHandle<Self>, app: &mut App)
Invokes layout_callback with
AnyRenderObject::invoke_layout_callback.
Must be called in perform_layout, and only after the callback was scheduled.
Sourcefn schedule_layout_callback(self: RenderHandle<Self>, app: &mut App)
fn schedule_layout_callback(self: RenderHandle<Self>, app: &mut App)
Schedules the layout callback to be run in the next layout pass, marking this object for layout.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".