pub struct WrapStyle {
pub axis: Axis,
pub align: Align,
pub column_gap: f32,
pub row_gap: f32,
pub columns: Option<usize>,
pub rows: Option<usize>,
}Expand description
Wrapping configuration for children along a main axis.
Fields§
§axis: AxisMain axis along which children are placed.
align: AlignCross-axis alignment of the items within each line.
column_gap: f32Gap between items on the same line.
row_gap: f32Gap between wrapped lines.
columns: Option<usize>Explicit number of columns, overriding width-based wrapping.
rows: Option<usize>Explicit number of rows, overriding width-based wrapping.
Implementations§
Source§impl WrapStyle
impl WrapStyle
Sourcepub fn column_gap(self, gap: f32) -> WrapStyle
pub fn column_gap(self, gap: f32) -> WrapStyle
Sets the gap between items on the same line.
Sourcepub fn align(self, align: Align) -> WrapStyle
pub fn align(self, align: Align) -> WrapStyle
Sets the cross-axis alignment of items within a line.
Sourcepub fn axis(self, axis: Axis) -> WrapStyle
pub fn axis(self, axis: Axis) -> WrapStyle
Sets the main axis and reinterprets the main and cross gaps.
Sourcepub fn columns(self, columns: usize) -> WrapStyle
pub fn columns(self, columns: usize) -> WrapStyle
Forces the layout to use exactly columns columns.
Values below one are clamped to one. For a horizontal axis this is the number of items per line; for a vertical axis it is the number of lines.
Sourcepub fn rows(self, rows: usize) -> WrapStyle
pub fn rows(self, rows: usize) -> WrapStyle
Forces the layout to use exactly rows rows.
Values below one are clamped to one. For a vertical axis this is the number of items per line; for a horizontal axis it is the number of lines.
Sourcepub fn clear_columns(self) -> WrapStyle
pub fn clear_columns(self) -> WrapStyle
Removes the explicit column count and restores width-based wrapping.
Sourcepub fn clear_rows(self) -> WrapStyle
pub fn clear_rows(self) -> WrapStyle
Removes the explicit row count and restores width-based wrapping.
Sourcepub fn items_per_line(self, count: usize) -> Option<usize>
pub fn items_per_line(self, count: usize) -> Option<usize>
Returns how many items fit on one line when an explicit count is set.
The count matching the main axis wins: columns for a horizontal
axis and rows for a vertical axis. The other count is treated as the
desired number of lines.