Struct taffy::compute::grid::types::grid_track::GridTrack

source ·
pub(in compute::grid) struct GridTrack {
    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,
}
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

Implementations§

source§

impl GridTrack

source

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 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 fit_content_limit(&self, axis_available_grid_space: Option<f32>) -> f32

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

source

pub fn fit_content_limited_growth_limit( &self, axis_available_grid_space: Option<f32>, ) -> f32

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

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 copy of the value. Read more
1.0.0 · 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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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.