Struct plasmo::Line

source ·
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> Line<T>

source

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

source§

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

source

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

Adds the start and end values together and returns the result

source§

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

source

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

source

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 Line<GenericGridPlacement<GridLine>>

source

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

source

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

source

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.

source

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

source

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::Points(0.0))

source§

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

source

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)

source§

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

source

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,

source

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,

source

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

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> Line<T>
where T: FromPoints,

source

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

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> Line<T>
where T: FromPercent,

source

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::Points(2.1))

Trait Implementations§

source§

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

source§

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

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

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for Line<GenericGridPlacement<GridLine>>

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

source§

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

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

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

source§

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

Converts into an Into<f32> into Self
source§

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

source§

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

Converts into an Into<f32> into Self
source§

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

source§

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

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

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

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

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

source§

const AUTO: Line<T> = _

The auto value for type implementing TaffyZero
source§

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

source§

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

Converts into a LengthPercentage into Self
source§

impl TaffyGridLine for Line<GenericGridPlacement<GridLine>>

source§

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

Converts an i16 into Self
source§

impl TaffyGridSpan for Line<GenericGridPlacement<GridLine>>

source§

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

Converts an iu6 into Self
source§

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

source§

const MAX_CONTENT: Line<T> = _

The max_content value for type implementing TaffyZero
source§

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

source§

const MIN_CONTENT: Line<T> = _

The min_content value for type implementing TaffyZero
source§

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

source§

const ZERO: Line<T> = _

The zero value for type implementing TaffyZero
source§

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

source§

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

source§

impl<T> StructuralEq for Line<T>

source§

impl<T> StructuralPartialEq for Line<T>

Auto Trait Implementations§

§

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
§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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
§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

§

fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

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

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

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
§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

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

§

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

§

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

§

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

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> CloneAny for T
where T: Any + Clone,