pub(crate) struct NamedLineResolver<S: CheapCloneStr> {
row_lines: HashMap<StrHasher<S>, Vec<u16>, RandomState>,
column_lines: HashMap<StrHasher<S>, Vec<u16>, RandomState>,
areas: HashMap<StrHasher<S>, GridTemplateArea<S>, RandomState>,
area_column_count: u16,
area_row_count: u16,
explicit_column_count: u16,
explicit_row_count: u16,
}Expand description
Resolver that takes grid lines names and area names as input and can then be used to resolve line names of grid placement properties into line numbers.
Fields§
§row_lines: HashMap<StrHasher<S>, Vec<u16>, RandomState>Map of row line names to line numbers. Each line name may correspond to multiple lines
so we store a Vec
column_lines: HashMap<StrHasher<S>, Vec<u16>, RandomState>Map of column line names to line numbers. Each line name may correspond to multiple lines
so we store a Vec
areas: HashMap<StrHasher<S>, GridTemplateArea<S>, RandomState>Map of area names to area definitions (start and end lines numbers in each axis)
area_column_count: u16Number of columns implied by grid area definitions
area_row_count: u16Number of rows implied by grid area definitions
explicit_column_count: u16The number of explicit columns in the grid. This is an input to the NamedLineResolver and is
used when computing the fallback line when a non-existent named line is specified.
explicit_row_count: u16The number of explicit rows in the grid. This is an input to the NamedLineResolver and is
used when computing the fallback line when a non-existent named line is specified.
Implementations§
Source§impl<S: CheapCloneStr> NamedLineResolver<S>
impl<S: CheapCloneStr> NamedLineResolver<S>
Sourcepub(crate) fn new(
style: &impl GridContainerStyle<CustomIdent = S>,
column_auto_repetitions: u16,
row_auto_repetitions: u16,
) -> Self
pub(crate) fn new( style: &impl GridContainerStyle<CustomIdent = S>, column_auto_repetitions: u16, row_auto_repetitions: u16, ) -> Self
Create and initialise a new NamedLineResolver
Sourcepub(crate) fn resolve_row_names(
&self,
line: &Line<GridPlacement<S>>,
) -> Line<GenericGridPlacement<GridLine>>
pub(crate) fn resolve_row_names( &self, line: &Line<GridPlacement<S>>, ) -> Line<GenericGridPlacement<GridLine>>
Resolve named lines for both the start and end of a row-axis grid placement
Sourcepub(crate) fn resolve_column_names(
&self,
line: &Line<GridPlacement<S>>,
) -> Line<GenericGridPlacement<GridLine>>
pub(crate) fn resolve_column_names( &self, line: &Line<GridPlacement<S>>, ) -> Line<GenericGridPlacement<GridLine>>
Resolve named lines for both the start and end of a column-axis grid placement
Sourcepub(crate) fn resolve_line_names(
&self,
line: &Line<GridPlacement<S>>,
axis: GridAreaAxis,
) -> Line<GenericGridPlacement<GridLine>>
pub(crate) fn resolve_line_names( &self, line: &Line<GridPlacement<S>>, axis: GridAreaAxis, ) -> Line<GenericGridPlacement<GridLine>>
Resolve named lines for both the start and end of a grid placement
Sourcefn find_line_index(
&self,
name: &S,
idx: i16,
axis: GridAreaAxis,
end: GridAreaEnd,
filter_lines: &dyn Fn(&[u16]) -> &[u16],
) -> GridLine
fn find_line_index( &self, name: &S, idx: i16, axis: GridAreaAxis, end: GridAreaEnd, filter_lines: &dyn Fn(&[u16]) -> &[u16], ) -> GridLine
Resolve the grid line for a named grid line or span
Sourcepub(crate) fn area_column_count(&self) -> u16
pub(crate) fn area_column_count(&self) -> u16
Get the number of columns defined by the grid areas
Sourcepub(crate) fn area_row_count(&self) -> u16
pub(crate) fn area_row_count(&self) -> u16
Get the number of rows defined by the grid areas
Sourcepub(crate) fn set_explicit_column_count(&mut self, count: u16)
pub(crate) fn set_explicit_column_count(&mut self, count: u16)
Set the number of columns in the explicit grid
Sourcepub(crate) fn set_explicit_row_count(&mut self, count: u16)
pub(crate) fn set_explicit_row_count(&mut self, count: u16)
Set the number of rows in the explicit grid