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§
§impl<T> Line<GenericGridPlacement<T>>where
T: GridCoordinate,
impl<T> Line<GenericGridPlacement<T>>where
T: GridCoordinate,
pub 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
§impl Line<GenericGridPlacement<GridLine>>
impl Line<GenericGridPlacement<GridLine>>
pub 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)
pub 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.
§impl Line<GenericGridPlacement<OriginZeroLine>>
impl Line<GenericGridPlacement<OriginZeroLine>>
pub 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
pub 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
pub 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.
pub 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
§impl<T> Line<T>where
T: TaffyMinContent,
impl<T> Line<T>where
T: TaffyMinContent,
pub 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)
§impl<T> Line<T>where
T: TaffyMaxContent,
impl<T> Line<T>where
T: TaffyMaxContent,
pub 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)
§impl<T> Line<T>where
T: TaffyFitContent,
impl<T> Line<T>where
T: TaffyFitContent,
pub 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.
§impl<T> Line<T>where
T: FromLength,
impl<T> Line<T>where
T: FromLength,
Trait Implementations§
§impl Default for Line<GenericGridPlacement<GridLine>>
impl Default for Line<GenericGridPlacement<GridLine>>
Represents the start and end points of a GridItem within a given axis
§impl<'de, T> Deserialize<'de> for Line<T>
impl<'de, T> Deserialize<'de> for Line<T>
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Line<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Line<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl<T> FromLength for Line<T>where
T: FromLength,
impl<T> FromLength for Line<T>where
T: FromLength,
§impl<T> FromPercent for Line<T>where
T: FromPercent,
impl<T> FromPercent for Line<T>where
T: FromPercent,
§impl<T> Serialize for Line<T>where
T: Serialize,
impl<T> Serialize for Line<T>where
T: Serialize,
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
§impl<T> TaffyFitContent for Line<T>where
T: TaffyFitContent,
impl<T> TaffyFitContent for Line<T>where
T: TaffyFitContent,
§fn fit_content(argument: LengthPercentage) -> Line<T>
fn fit_content(argument: LengthPercentage) -> Line<T>
§impl TaffyGridLine for Line<GenericGridPlacement<GridLine>>
impl TaffyGridLine for Line<GenericGridPlacement<GridLine>>
§fn from_line_index(index: i16) -> Line<GenericGridPlacement<GridLine>>
fn from_line_index(index: i16) -> Line<GenericGridPlacement<GridLine>>
§impl TaffyGridSpan for Line<GenericGridPlacement<GridLine>>
impl TaffyGridSpan for Line<GenericGridPlacement<GridLine>>
§impl<T> TaffyMaxContent for Line<T>where
T: TaffyMaxContent,
impl<T> TaffyMaxContent for Line<T>where
T: TaffyMaxContent,
§const MAX_CONTENT: Line<T> = _
const MAX_CONTENT: Line<T> = _
§impl<T> TaffyMinContent for Line<T>where
T: TaffyMinContent,
impl<T> TaffyMinContent for Line<T>where
T: TaffyMinContent,
§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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more