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: TThe start position of a line
end: TThe end position of a line
Implementations§
Source§impl<S> Line<GridPlacement<S>>where
S: CheapCloneStr,
impl<S> Line<GridPlacement<S>>where
S: CheapCloneStr,
Sourcepub fn into_origin_zero_ignoring_named(
&self,
explicit_track_count: u16,
) -> Line<GenericGridPlacement<OriginZeroLine>>
pub fn into_origin_zero_ignoring_named( &self, explicit_track_count: u16, ) -> Line<GenericGridPlacement<OriginZeroLine>>
Apply a mapping function if the GridPlacement is a Line. Otherwise return self unmodified.
Source§impl<T> Line<GenericGridPlacement<T>>where
T: GridCoordinate,
impl<T> Line<GenericGridPlacement<T>>where
T: GridCoordinate,
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 Tracks).
Panics if called on a definite placement
Source§impl<S> Line<GridPlacement<S>>where
S: CheapCloneStr,
impl<S> Line<GridPlacement<S>>where
S: CheapCloneStr,
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 NON-ZERO track index (0 is an invalid line in GridLine coordinates, and falls back to “auto” which is indefinite)
Source§impl Line<GenericGridPlacement<GridLine>>
impl Line<GenericGridPlacement<GridLine>>
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 NON-ZERO track index (0 is an invalid line in GridLine coordinates, and falls back to “auto” which is indefinite)
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 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 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> Line<T>where
T: TaffyMinContent,
impl<T> Line<T>where
T: TaffyMinContent,
Sourcepub const fn min_content() -> Line<T>
pub const fn min_content() -> Line<T>
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> Line<T>where
T: TaffyMaxContent,
impl<T> Line<T>where
T: TaffyMaxContent,
Sourcepub const fn max_content() -> Line<T>
pub const fn max_content() -> Line<T>
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> Line<T>where
T: TaffyFitContent,
impl<T> Line<T>where
T: TaffyFitContent,
Sourcepub fn fit_content(argument: LengthPercentage) -> Line<T>
pub fn fit_content(argument: LengthPercentage) -> Line<T>
Returns a Line with start and end set to the same fit-content(…) value
with the given argument.
Source§impl<T> Line<T>where
T: FromLength,
impl<T> Line<T>where
T: FromLength,
Trait Implementations§
Source§impl<S> Default for Line<GridPlacement<S>>where
S: CheapCloneStr,
Represents the start and end points of a GridItem within a given axis
impl<S> Default for Line<GridPlacement<S>>where
S: CheapCloneStr,
Represents the start and end points of a GridItem within a given axis
Source§impl<T> FromLength for Line<T>where
T: FromLength,
impl<T> FromLength for Line<T>where
T: FromLength,
Source§impl<T> FromPercent for Line<T>where
T: FromPercent,
impl<T> FromPercent for Line<T>where
T: FromPercent,
Source§impl<T> TaffyFitContent for Line<T>where
T: TaffyFitContent,
impl<T> TaffyFitContent for Line<T>where
T: TaffyFitContent,
Source§fn fit_content(argument: LengthPercentage) -> Line<T>
fn fit_content(argument: LengthPercentage) -> Line<T>
Source§impl<S> TaffyGridLine for Line<GridPlacement<S>>where
S: CheapCloneStr,
impl<S> TaffyGridLine for Line<GridPlacement<S>>where
S: CheapCloneStr,
Source§fn from_line_index(index: i16) -> Line<GridPlacement<S>>
fn from_line_index(index: i16) -> Line<GridPlacement<S>>
Source§impl<S> TaffyGridSpan for Line<GridPlacement<S>>where
S: CheapCloneStr,
impl<S> TaffyGridSpan for Line<GridPlacement<S>>where
S: CheapCloneStr,
Source§impl<T> TaffyMaxContent for Line<T>where
T: TaffyMaxContent,
impl<T> TaffyMaxContent for Line<T>where
T: TaffyMaxContent,
Source§const MAX_CONTENT: Line<T>
const MAX_CONTENT: Line<T>
Source§impl<T> TaffyMinContent for Line<T>where
T: TaffyMinContent,
impl<T> TaffyMinContent for Line<T>where
T: TaffyMinContent,
Source§const MIN_CONTENT: Line<T>
const MIN_CONTENT: Line<T>
impl<T> Copy for Line<T>where
T: Copy,
impl<T> Eq for Line<T>where
T: Eq,
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§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.