pub trait GridView: View {
// Provided methods
fn grid_auto_flow(self, flow: GridAutoFlow) -> Self { ... }
fn grid_auto_columns(self, tracks: Vec<GridTrack>) -> Self { ... }
fn grid_auto_rows(self, tracks: Vec<GridTrack>) -> Self { ... }
fn grid_template_columns(self, tracks: Vec<RepeatedGridTrack>) -> Self { ... }
fn grid_template_rows(self, tracks: Vec<RepeatedGridTrack>) -> Self { ... }
fn justify_content(self, justify: JustifyContent) -> Self { ... }
fn align_items(self, align_items: AlignItems) -> Self { ... }
fn row_gap(self, gap: Val) -> Self { ... }
fn column_gap(self, gap: Val) -> Self { ... }
}Expand description
Provides a fluent interface for configuring grid layout containers.
This trait is intended for views that participate in CSS-like grid layouts. It enables precise definition of tracks (rows and columns), gaps, flow behavior, and alignment along both axes, using a builder-style API.
Provided Methods§
Sourcefn grid_auto_flow(self, flow: GridAutoFlow) -> Self
fn grid_auto_flow(self, flow: GridAutoFlow) -> Self
Sets the flow algorithm used to place items in the grid.
§Arguments
flow– Determines item placement strategy, such asRow,Column,RowDense, orColumnDense.
Sourcefn grid_auto_columns(self, tracks: Vec<GridTrack>) -> Self
fn grid_auto_columns(self, tracks: Vec<GridTrack>) -> Self
Specifies the sizing behavior for automatically created columns.
Applies when children overflow the defined template or no template columns are set.
§Arguments
tracks– A vector ofGridTrackvalues that define implicit column sizing.
Sourcefn grid_auto_rows(self, tracks: Vec<GridTrack>) -> Self
fn grid_auto_rows(self, tracks: Vec<GridTrack>) -> Self
Specifies the sizing behavior for automatically created rows.
Applies when content exceeds the defined row template.
§Arguments
tracks– A vector ofGridTrackvalues that define implicit row sizing.
Sourcefn grid_template_columns(self, tracks: Vec<RepeatedGridTrack>) -> Self
fn grid_template_columns(self, tracks: Vec<RepeatedGridTrack>) -> Self
Defines the column track template for this grid.
Explicitly sets the layout behavior of each column.
§Arguments
tracks– A vector ofRepeatedGridTrackvalues to control each column’s size and repeat behavior.
Sourcefn grid_template_rows(self, tracks: Vec<RepeatedGridTrack>) -> Self
fn grid_template_rows(self, tracks: Vec<RepeatedGridTrack>) -> Self
Defines the row track template for this grid.
Explicitly sets the layout behavior of each row.
§Arguments
tracks– A vector ofRepeatedGridTrackvalues to control each row’s size and repeat behavior.
Sourcefn justify_content(self, justify: JustifyContent) -> Self
fn justify_content(self, justify: JustifyContent) -> Self
Aligns all grid content along the main axis (horizontal in LTR layouts).
§Arguments
justify– Justification mode (e.g.Start,Center,SpaceBetween).
Sourcefn align_items(self, align_items: AlignItems) -> Self
fn align_items(self, align_items: AlignItems) -> Self
Aligns grid items along the cross axis (vertical in LTR layouts).
§Arguments
align_items– Alignment mode for items within their cells.
Sourcefn row_gap(self, gap: Val) -> Self
fn row_gap(self, gap: Val) -> Self
Sets the vertical spacing between grid rows.
§Arguments
gap– The space to insert between rows, usingVal::Px,Val::Percent, etc.
Sourcefn column_gap(self, gap: Val) -> Self
fn column_gap(self, gap: Val) -> Self
Sets the horizontal spacing between grid columns.
§Arguments
gap– The space to insert between columns, usingVal::Px,Val::Percent, etc.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.