pub struct DetailedGridTracksInfo<S: CheapCloneStr = String> {
pub negative_implicit_tracks: u16,
pub explicit_tracks: u16,
pub positive_implicit_tracks: u16,
pub positions: Vec<Line<f32>>,
pub collapsed_tracks: Vec<Range<usize>>,
pub empty_axis_line: Option<f32>,
pub line_names: GridLineNames<S>,
}Expand description
Information from the computation of grids tracks
Fields§
§negative_implicit_tracks: u16Number of leading implicit grid tracks
explicit_tracks: u16Number of explicit grid tracks
positive_implicit_tracks: u16Number of trailing implicit grid tracks
positions: Vec<Line<f32>>The start and end position of each track relative to the grid container’s border box.
These positions account for the container’s border and padding, the gap property,
content alignment (align-content/justify-content), and collapsed tracks.
collapsed_tracks: Vec<Range<usize>>Sorted, disjoint ranges of collapsed auto-fit tracks (indices into positions), whose
adjacent gutters overlap when resolving absolute grid-area edges. Empty (and never
allocated) unless a track collapsed.
empty_axis_line: Option<f32>The position of the axis’ single grid line relative to the grid container’s border box
when the axis has no tracks (an empty grid still contains one grid line in each axis,
positioned by content alignment). None when the axis has tracks.
line_names: GridLineNames<S>The names of each explicit grid line. Stored line i (0-indexed) bounds the start of
explicit track i; use DetailedGridTracksInfo::names_for_line or
DetailedGridTracksInfo::iter_line_names for indices relative to the full grid
(including implicit tracks). Empty if the grid has no named lines.
Implementations§
Source§impl<S: CheapCloneStr> DetailedGridTracksInfo<S>
impl<S: CheapCloneStr> DetailedGridTracksInfo<S>
Sourcefn resolve_absolute_grid_axis(
&self,
placement: Line<GridPlacement<S>>,
areas: &HashMap<StrHasher<S>, AreaLines, RandomState>,
axis: GridAreaAxis,
padding_start: f32,
padding_end: f32,
is_reversed: bool,
) -> Line<f32>
fn resolve_absolute_grid_axis( &self, placement: Line<GridPlacement<S>>, areas: &HashMap<StrHasher<S>, AreaLines, RandomState>, axis: GridAreaAxis, padding_start: f32, padding_end: f32, is_reversed: bool, ) -> Line<f32>
Resolve an absolute placement in this axis to physical start and end coordinates
Source§impl<S: CheapCloneStr> DetailedGridTracksInfo<S>
impl<S: CheapCloneStr> DetailedGridTracksInfo<S>
Sourcefn positions_from_grid_track_layout(
grid_tracks: &[GridTrack],
) -> (Vec<Line<f32>>, Vec<Range<usize>>)
fn positions_from_grid_track_layout( grid_tracks: &[GridTrack], ) -> (Vec<Line<f32>>, Vec<Range<usize>>)
Get the start and end position of each track relative to the grid container’s border box,
along with the index ranges of any runs of collapsed auto-fit tracks
Sourcefn from_grid_tracks_and_track_count(
track_count: TrackCounts,
grid_tracks: Vec<GridTrack>,
line_names: GridLineNames<S>,
) -> Self
fn from_grid_tracks_and_track_count( track_count: TrackCounts, grid_tracks: Vec<GridTrack>, line_names: GridLineNames<S>, ) -> Self
Construct DetailedGridTracksInfo from TrackCounts and GridTracks
Sourcepub fn names_for_line(&self, line_index: usize) -> &[S]
pub fn names_for_line(&self, line_index: usize) -> &[S]
The names of the grid line with the passed 0-indexed line index, where line i bounds
the start of track i of the full grid (including implicit tracks).
Returns an empty slice if the line has no names or the index is out of range.
Sourcepub fn iter_line_names(&self) -> GridLineNamesIter<'_, S> ⓘ
pub fn iter_line_names(&self) -> GridLineNamesIter<'_, S> ⓘ
Iterate over the name group (&[S]) of each grid line of the full grid (including
implicit tracks) in line order, yielding empty groups for unnamed (implicit) lines.
Yields nothing if the grid has no named lines.
Sourcepub fn write_track_list(&self, out: &mut impl Write, zoom: f32) -> Result
pub fn write_track_list(&self, out: &mut impl Write, zoom: f32) -> Result
Write the used track sizes and line names of this axis to the passed writer in the
resolved value format of the grid-template-rows/grid-template-columns properties
(see https://www.w3.org/TR/css-grid-1/#resolved-track-list)
Track sizes are divided by zoom (the container’s effective CSS zoom, or 1.0) to give unzoomed px.
Sourcepub fn to_track_list_string(&self, zoom: f32) -> String
pub fn to_track_list_string(&self, zoom: f32) -> String
Serialize the used track sizes and line names of this axis in the resolved value format of
the grid-template-rows/grid-template-columns properties
(see https://www.w3.org/TR/css-grid-1/#resolved-track-list)
Track sizes are divided by zoom (the container’s effective CSS zoom, or 1.0) to give unzoomed px.
Trait Implementations§
Source§impl<S: Clone + CheapCloneStr> Clone for DetailedGridTracksInfo<S>
impl<S: Clone + CheapCloneStr> Clone for DetailedGridTracksInfo<S>
Source§fn clone(&self) -> DetailedGridTracksInfo<S>
fn clone(&self) -> DetailedGridTracksInfo<S>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more