pub trait TableColumnWidth: Debug {
// Required methods
fn min_intrinsic_width(
&self,
app: &mut App,
cells: &[AnyRenderBox],
container_width: f64,
) -> f64;
fn max_intrinsic_width(
&self,
app: &mut App,
cells: &[AnyRenderBox],
container_width: f64,
) -> f64;
fn as_any(&self) -> &dyn Any;
// Provided method
fn flex(&self, app: &mut App, cells: &[AnyRenderBox]) -> Option<f64> { ... }
}Expand description
Base class to describe how wide a column in a RenderTable should be.
To size a column to a specific number of pixels, use a FixedColumnWidth. This is the
cheapest way to size a column.
Other algorithms that are relatively cheap include FlexColumnWidth, which distributes
the space equally among the flexible columns, FractionColumnWidth, which sizes a column
based on the size of the table’s container.
Required Methods§
Sourcefn min_intrinsic_width(
&self,
app: &mut App,
cells: &[AnyRenderBox],
container_width: f64,
) -> f64
fn min_intrinsic_width( &self, app: &mut App, cells: &[AnyRenderBox], container_width: f64, ) -> f64
The smallest width that the column can have.
The cells argument is an iterable that provides all the cells in the table for this
column. Walking the cells is by definition O(N), so algorithms that do that should be
considered expensive.
The container_width argument is the max_width of the incoming constraints for the
table, and might be infinite.
Sourcefn max_intrinsic_width(
&self,
app: &mut App,
cells: &[AnyRenderBox],
container_width: f64,
) -> f64
fn max_intrinsic_width( &self, app: &mut App, cells: &[AnyRenderBox], container_width: f64, ) -> f64
The ideal width that the column should have. This must be equal to or greater than the
min_intrinsic_width. The column might be bigger than this
width, e.g. if the column is flexible or if the table’s width ends up being forced to be
bigger than the sum of all the max_intrinsic_width values.
The cells argument is an iterable that provides all the cells in the table for this
column. Walking the cells is by definition O(N), so algorithms that do that should be
considered expensive.
The container_width argument is the max_width of the incoming constraints for the
table, and might be infinite.
Provided Methods§
Sourcefn flex(&self, app: &mut App, cells: &[AnyRenderBox]) -> Option<f64>
fn flex(&self, app: &mut App, cells: &[AnyRenderBox]) -> Option<f64>
The flex factor to apply to the cell if there is any room left over when laying out the table. The remaining space is distributed to any columns with flex in proportion to their flex value (higher values get more space).
The cells argument is an iterable that provides all the cells in the table for this
column. Walking the cells is by definition O(N), so algorithms that do that should be
considered expensive.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".