Struct lay_rs::prelude::taffy::Line

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<T>

pub fn map<R, F>(self, f: F) -> Line<R>
where F: Fn(T) -> R,

Applies the function f to both the width and height

This is used to transform a Line<T> into a Line<R>.

§

impl Line<bool>

pub const TRUE: Line<bool> = _

A Line<bool> with both start and end set to true

pub const FALSE: Line<bool> = _

A Line<bool> with both start and end set to false

§

impl<T> Line<T>
where T: Add + Copy,

pub fn sum(&self) -> <T as Add>::Output

Adds the start and end values together and returns the result

§

impl<T> Line<GenericGridPlacement<T>>
where T: GridCoordinate,

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

§

impl Line<GenericGridPlacement<GridLine>>

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>>

Apply a mapping function if the GridPlacement is a Track. Otherwise return self unmodified.

§

impl Line<GenericGridPlacement<OriginZeroLine>>

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>

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>>

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>

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: TaffyZero,

pub const fn zero() -> Line<T>

Returns a Line where both the start and end values are the zero value of the contained type (e.g. 0.0, Some(0.0), or Dimension::Length(0.0))

§

impl<T> Line<T>
where T: TaffyAuto,

pub const fn auto() -> Line<T>

Returns a Line where both the start and end values are the auto value of the contained type (e.g. Dimension::Auto or LengthPercentageAuto::Auto)

§

impl<T> Line<T>
where T: TaffyMinContent,

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,

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,

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,

pub fn length<Input>(value: Input) -> Line<T>
where Input: Into<f32> + Copy,

Returns a Line where both the start and end values are the same given absolute length

§

impl<T> Line<T>
where T: FromPercent,

pub fn percent<Input>(percent_value: Input) -> Line<T>
where Input: Into<f32> + Copy,

Returns a Line where both the start and end values are the constant percent value of the contained type (e.g. 2.1, Some(2.1), or Dimension::Length(2.1))

Trait Implementations§

§

impl<T> Clone for Line<T>
where T: Clone,

§

fn clone(&self) -> Line<T>

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
§

impl<T> Debug for Line<T>
where T: Debug,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Default for Line<GenericGridPlacement<GridLine>>

Represents the start and end points of a GridItem within a given axis

§

fn default() -> Line<GenericGridPlacement<GridLine>>

Returns the “default value” for a type. Read more
§

impl<'de, T> Deserialize<'de> for Line<T>
where Line<T>: Default, T: Deserialize<'de>,

§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Line<T>, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl<T> FromLength for Line<T>
where T: FromLength,

§

fn from_length<Input>(value: Input) -> Line<T>
where Input: Into<f32> + Copy,

Converts into an Into<f32> into Self
§

impl<T> FromPercent for Line<T>
where T: FromPercent,

§

fn from_percent<Input>(percent: Input) -> Line<T>
where Input: Into<f32> + Copy,

Converts into an Into<f32> into Self
§

impl<T> PartialEq for Line<T>
where T: PartialEq,

§

fn eq(&self, other: &Line<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

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,

Serialize this value into the given Serde serializer. Read more
§

impl<T> TaffyAuto for Line<T>
where T: TaffyAuto,

§

const AUTO: Line<T> = _

The auto value for type implementing TaffyAuto
§

impl<T> TaffyFitContent for Line<T>
where T: TaffyFitContent,

§

fn fit_content(argument: LengthPercentage) -> Line<T>

Converts a LengthPercentage into Self
§

impl TaffyGridLine for Line<GenericGridPlacement<GridLine>>

§

fn from_line_index(index: i16) -> Line<GenericGridPlacement<GridLine>>

Converts an i16 into Self
§

impl TaffyGridSpan for Line<GenericGridPlacement<GridLine>>

§

fn from_span(span: u16) -> Line<GenericGridPlacement<GridLine>>

Converts an iu6 into Self
§

impl<T> TaffyMaxContent for Line<T>
where T: TaffyMaxContent,

§

const MAX_CONTENT: Line<T> = _

The max_content value for type implementing TaffyZero
§

impl<T> TaffyMinContent for Line<T>
where T: TaffyMinContent,

§

const MIN_CONTENT: Line<T> = _

The min_content value for type implementing TaffyZero
§

impl<T> TaffyZero for Line<T>
where T: TaffyZero,

§

const ZERO: Line<T> = _

The zero value for type implementing TaffyZero
§

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> 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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,