pub struct GridTemplate {
pub columns: Vec<TrackSize>,
pub rows: Vec<TrackSize>,
pub column_gap: f32,
pub row_gap: f32,
pub areas: HashMap<String, GridArea>,
}Expand description
Grid template definition.
Fields§
§columns: Vec<TrackSize>Column track sizes
rows: Vec<TrackSize>Row track sizes
column_gap: f32Gap between columns
row_gap: f32Gap between rows
areas: HashMap<String, GridArea>Named grid areas (row-major order)
Implementations§
Source§impl GridTemplate
impl GridTemplate
Sourcepub fn columns(cols: impl IntoIterator<Item = TrackSize>) -> Self
pub fn columns(cols: impl IntoIterator<Item = TrackSize>) -> Self
Create a grid with specified columns and default 1fr rows.
Sourcepub fn twelve_column() -> Self
pub fn twelve_column() -> Self
Create a 12-column grid (common dashboard layout).
Sourcepub fn with_rows(self, rows: impl IntoIterator<Item = TrackSize>) -> Self
pub fn with_rows(self, rows: impl IntoIterator<Item = TrackSize>) -> Self
Set row track sizes.
Sourcepub const fn with_column_gap(self, gap: f32) -> Self
pub const fn with_column_gap(self, gap: f32) -> Self
Set column gap.
Sourcepub const fn with_row_gap(self, gap: f32) -> Self
pub const fn with_row_gap(self, gap: f32) -> Self
Set row gap.
Sourcepub fn column_count(&self) -> usize
pub fn column_count(&self) -> usize
Get number of columns.
Trait Implementations§
Source§impl Clone for GridTemplate
impl Clone for GridTemplate
Source§fn clone(&self) -> GridTemplate
fn clone(&self) -> GridTemplate
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GridTemplate
impl Debug for GridTemplate
Source§impl Default for GridTemplate
impl Default for GridTemplate
Source§fn default() -> GridTemplate
fn default() -> GridTemplate
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for GridTemplate
impl<'de> Deserialize<'de> for GridTemplate
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for GridTemplate
impl RefUnwindSafe for GridTemplate
impl Send for GridTemplate
impl Sync for GridTemplate
impl Unpin for GridTemplate
impl UnwindSafe for GridTemplate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more