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 with start and end set to the same fit-content(…)
value
with the given argument.
source§impl<T: FromLength> Line<T>
impl<T: FromLength> 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
source§impl<T: FromLength> FromLength for Line<T>
impl<T: FromLength> FromLength for Line<T>
source§impl<T: FromPercent> FromPercent for Line<T>
impl<T: FromPercent> FromPercent for Line<T>
source§impl<T: TaffyFitContent> TaffyFitContent for Line<T>
impl<T: TaffyFitContent> TaffyFitContent for Line<T>
source§fn fit_content(argument: LengthPercentage) -> Self
fn fit_content(argument: LengthPercentage) -> Self
source§impl TaffyGridLine for Line<GridPlacement>
impl TaffyGridLine for Line<GridPlacement>
source§fn from_line_index(index: i16) -> Self
fn from_line_index(index: i16) -> Self
source§impl TaffyGridSpan for Line<GridPlacement>
impl TaffyGridSpan for Line<GridPlacement>
source§impl<T: TaffyMaxContent> TaffyMaxContent for Line<T>
impl<T: TaffyMaxContent> TaffyMaxContent for Line<T>
source§const MAX_CONTENT: Line<T> = _
const MAX_CONTENT: Line<T> = _
source§impl<T: TaffyMinContent> TaffyMinContent for Line<T>
impl<T: TaffyMinContent> TaffyMinContent for Line<T>
source§const MIN_CONTENT: Line<T> = _
const MIN_CONTENT: Line<T> = _
impl<T: Copy> Copy for Line<T>
impl<T: Eq> Eq for Line<T>
impl<T> StructuralPartialEq for Line<T>
Auto Trait Implementations§
impl<T> Freeze for Line<T>where
T: Freeze,
impl<T> RefUnwindSafe for Line<T>where
T: RefUnwindSafe,
impl<T> Send for Line<T>where
T: Send,
impl<T> Sync for Line<T>where
T: Sync,
impl<T> Unpin for Line<T>where
T: Unpin,
impl<T> UnwindSafe for Line<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)