Skip to main content

DetailedGridTracksInfo

Struct DetailedGridTracksInfo 

Source
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: u16

Number of leading implicit grid tracks

§explicit_tracks: u16

Number of explicit grid tracks

§positive_implicit_tracks: u16

Number 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>

Source

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

fn absolute_track_edge( &self, index: usize, is_start: bool, is_reversed: bool, ) -> f32

Resolve a track edge, excluding gutters that overlap across a collapsed track run.

Source§

impl<S: CheapCloneStr> DetailedGridTracksInfo<S>

Source

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

Source

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

Source

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.

Source

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.

Source

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.

Source

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>

Source§

fn clone(&self) -> DetailedGridTracksInfo<S>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S: Debug + CheapCloneStr> Debug for DetailedGridTracksInfo<S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S: PartialEq + CheapCloneStr> PartialEq for DetailedGridTracksInfo<S>

Source§

fn eq(&self, other: &DetailedGridTracksInfo<S>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<S: PartialEq + CheapCloneStr> StructuralPartialEq for DetailedGridTracksInfo<S>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.