Skip to main content

GridTrack

Struct GridTrack 

Source
pub(in compute::grid) struct GridTrack {
Show 13 fields pub kind: GridTrackKind, pub is_collapsed: bool, pub min_track_sizing_function: MinTrackSizingFunction, pub max_track_sizing_function: MaxTrackSizingFunction, pub offset: f32, pub base_size: f32, pub growth_limit: f32, pub content_alignment_adjustment: f32, pub item_incurred_increase: f32, pub base_size_planned_increase: f32, pub growth_limit_planned_increase: f32, pub infinitely_growable: bool, pub fit_content_limit: f32,
}
Expand description

Internal sizing information for a single grid track (row/column) Gutters between tracks are sized similarly to actual tracks, so they are also represented by this struct

Fields§

§kind: GridTrackKind

Whether the track is a full track, a gutter, or a placeholder that has not yet been initialised

§is_collapsed: bool

Whether the track is a collapsed track/gutter. Collapsed tracks are effectively treated as if they don’t exist for the purposes of grid sizing. Gutters between collapsed tracks are also collapsed.

§min_track_sizing_function: MinTrackSizingFunction

The minimum track sizing function of the track

§max_track_sizing_function: MaxTrackSizingFunction

The maximum track sizing function of the track

§offset: f32

The distance of the start of the track from the start of the grid container

§base_size: f32

The size (width/height as applicable) of the track

§growth_limit: f32

A temporary scratch value when sizing tracks Note: can be infinity

§content_alignment_adjustment: f32

A temporary scratch value when sizing tracks. Is used as an additional amount to add to the estimate for the available space in the opposite axis when content sizing items

§item_incurred_increase: f32

A temporary scratch value when “distributing space” to avoid clobbering planned increase variable

§base_size_planned_increase: f32

A temporary scratch value when “distributing space” to avoid clobbering the main variable

§growth_limit_planned_increase: f32

A temporary scratch value when “distributing space” to avoid clobbering the main variable

§infinitely_growable: bool

A temporary scratch value when “distributing space” See: https://www.w3.org/TR/css3-grid-layout/#infinitely-growable

§fit_content_limit: f32

The resolved fit-content() limit of the max track sizing function (infinity if it is not fit-content() or the limit cannot be resolved). Resolved once per track sizing pass by resolve_fit_content_limit.

Implementations§

Source§

impl GridTrack

Source

const fn new_with_kind( kind: GridTrackKind, min_track_sizing_function: MinTrackSizingFunction, max_track_sizing_function: MaxTrackSizingFunction, ) -> GridTrack

GridTrack constructor with all configuration parameters for the other constructors exposed

Source

pub const fn new( min_track_sizing_function: MinTrackSizingFunction, max_track_sizing_function: MaxTrackSizingFunction, ) -> GridTrack

Create new GridTrack representing an actual track (not a gutter)

Source

pub fn gutter(size: LengthPercentage) -> GridTrack

Create a new GridTrack representing a gutter

Source

pub fn collapse(&mut self)

Mark a GridTrack as collapsed. Also sets both of the track’s sizing functions to fixed zero-sized sizing functions.

Source

pub fn is_flexible(&self) -> bool

Returns true if the track is flexible (has a Flex MaxTrackSizingFunction), else false.

Source

pub fn uses_percentage(&self) -> bool

Returns true if the track is flexible (has a Flex MaxTrackSizingFunction), else false.

Source

pub fn has_intrinsic_sizing_function(&self) -> bool

Returns true if the track has an intrinsic min and or max sizing function

Source

pub fn resolve_fit_content_limit( &mut self, axis_inner_node_size: Option<f32>, calc_resolver: impl Fn(*const (), f32) -> f32, )

Cache the fit-content() limit of the max track sizing function (if any), resolved against the container’s inner size in this axis. Percentage and calc() limits resolve to infinity if that size is indefinite, as do tracks which are not fit-content().

Source

pub fn fit_content_limit(&self) -> f32

Returns the resolved fit-content() limit of the track (infinity if the track is not fit-content())

Source

pub fn fit_content_limited_growth_limit(&self) -> f32

Returns the track’s growth limit, capped by its fit-content() limit (if any)

Source

pub fn flex_factor(&self) -> f32

Returns the track’s flex factor if it is a flex track, else 0.

Trait Implementations§

Source§

impl Clone for GridTrack

Source§

fn clone(&self) -> GridTrack

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 Debug for GridTrack

Source§

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

Formats the value using the given formatter. Read more

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.