pub struct Line<T> {
pub start: T,
pub end: T,
}
Expand description
An abstract “line”. Represents any type that has a start and an end
Fields§
§start: T
The start position of a line
end: T
The end position of a line
Implementations§
source§impl<T: GridCoordinate> Line<GenericGridPlacement<T>>
impl<T: GridCoordinate> Line<GenericGridPlacement<T>>
sourcepub fn is_definite(&self) -> bool
pub fn is_definite(&self) -> bool
Whether the track position is definite in this axis (or the item will need auto placement) The track position is definite if least one of the start and end positions is a track index
sourcepub fn indefinite_span(&self) -> u16
pub fn indefinite_span(&self) -> u16
Resolves the span for an indefinite placement (a placement that does not consist of two Track
s).
Panics if called on a definite placement
source§impl Line<GridPlacement>
impl Line<GridPlacement>
sourcepub fn into_origin_zero(
&self,
explicit_track_count: u16
) -> Line<GenericGridPlacement<OriginZeroLine>>
pub fn into_origin_zero( &self, explicit_track_count: u16 ) -> Line<GenericGridPlacement<OriginZeroLine>>
Apply a mapping function if the GridPlacement
is a Track
. Otherwise return self
unmodified.
source§impl Line<GenericGridPlacement<OriginZeroLine>>
impl Line<GenericGridPlacement<OriginZeroLine>>
sourcepub fn resolve_definite_grid_lines(&self) -> Line<OriginZeroLine>
pub fn resolve_definite_grid_lines(&self) -> Line<OriginZeroLine>
If at least one of the of the start and end positions is a track index then the other end can be resolved into a track index purely based on the information contained with the placement specification
sourcepub fn resolve_absolutely_positioned_grid_tracks(
&self
) -> Line<Option<OriginZeroLine>>
pub fn resolve_absolutely_positioned_grid_tracks( &self ) -> Line<Option<OriginZeroLine>>
For absolutely positioned items:
- Tracks resolve to definite tracks
- For Spans:
- If the other position is a Track, they resolve to a definite track relative to the other track
- Else resolve to None
- Auto resolves to None
When finally positioning the item, a value of None means that the item’s grid area is bounded by the grid container’s border box on that side.
sourcepub fn resolve_indefinite_grid_tracks(
&self,
start: OriginZeroLine
) -> Line<OriginZeroLine>
pub fn resolve_indefinite_grid_tracks( &self, start: OriginZeroLine ) -> Line<OriginZeroLine>
If neither of the start and end positions is a track index then the other end can be resolved into a track index if a definite start position is supplied externally
source§impl<T: TaffyMinContent> Line<T>
impl<T: TaffyMinContent> Line<T>
sourcepub const fn min_content() -> Self
pub const fn min_content() -> Self
Returns a Line where both the start and end values are the min_content value of the contained type (e.g. Dimension::Auto or LengthPercentageAuto::Auto)
source§impl<T: TaffyMaxContent> Line<T>
impl<T: TaffyMaxContent> Line<T>
sourcepub const fn max_content() -> Self
pub const fn max_content() -> Self
Returns a Line where both the start and end values are the max_content value of the contained type (e.g. Dimension::Auto or LengthPercentageAuto::Auto)
source§impl<T: TaffyFitContent> Line<T>
impl<T: TaffyFitContent> Line<T>
sourcepub fn fit_content(argument: LengthPercentage) -> Self
pub fn fit_content(argument: LengthPercentage) -> Self
Returns a Line where both the start and end values are the constant points value of the contained type (e.g. 2.1, Some(2.1), or Dimension::Points(2.1))
source§impl<T: FromPoints> Line<T>
impl<T: FromPoints> Line<T>
Trait Implementations§
source§impl Default for Line<GridPlacement>
impl Default for Line<GridPlacement>
Represents the start and end points of a GridItem within a given axis