pub trait LayoutView: Send {
// Required methods
fn size_that_fits(
&self,
proposal: SizeProposal,
subviews: &[&dyn LayoutView],
cache: &mut LayoutCache,
) -> Size;
fn place_subviews(
&self,
bounds: Rect,
subviews: &mut [&mut dyn LayoutView],
cache: &mut LayoutCache,
);
// Provided methods
fn flex_weight(&self) -> f32 { ... }
fn debug_layout(&self, indent: usize) -> String { ... }
}Expand description
A view that can participate in layout
Required Methods§
Sourcefn size_that_fits(
&self,
proposal: SizeProposal,
subviews: &[&dyn LayoutView],
cache: &mut LayoutCache,
) -> Size
fn size_that_fits( &self, proposal: SizeProposal, subviews: &[&dyn LayoutView], cache: &mut LayoutCache, ) -> Size
Propose a size for this view given the available space
Sourcefn place_subviews(
&self,
bounds: Rect,
subviews: &mut [&mut dyn LayoutView],
cache: &mut LayoutCache,
)
fn place_subviews( &self, bounds: Rect, subviews: &mut [&mut dyn LayoutView], cache: &mut LayoutCache, )
Place subviews within the given bounds
Provided Methods§
Sourcefn flex_weight(&self) -> f32
fn flex_weight(&self) -> f32
Returns the flex weight of this view (default is 0.0, which means fixed/intrinsic)
Sourcefn debug_layout(&self, indent: usize) -> String
fn debug_layout(&self, indent: usize) -> String
Return a debug representation of this layout subtree.
The indent parameter controls the indentation level for nested display.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".