Struct taffy::geometry::Point

source ·
pub struct Point<T> {
    pub x: T,
    pub y: T,
}
Expand description

A 2-dimensional coordinate.

When used in association with a Rect, represents the top-left corner.

Fields§

§x: T

The x-coordinate

§y: T

The y-coordinate

Implementations§

source§

impl Point<f32>

source

pub const ZERO: Self = _

A Point with values (0,0), representing the origin

source§

impl Point<Option<f32>>

source

pub const NONE: Self = _

A Point with values (None, None)

source§

impl<T> Point<T>

source

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

Applies the function f to both the x and y

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

source

pub fn get(self, axis: AbstractAxis) -> T

Gets the extent of the specified layout axis Whether this is the width or height depends on the GridAxis provided

source

pub fn transpose(self) -> Point<T>

Swap x and y components

source

pub fn set(&mut self, axis: AbstractAxis, value: T)

Sets the extent of the specified layout axis Whether this is the width or height depends on the GridAxis provided

source§

impl<T: TaffyZero> Point<T>

source

pub const fn zero() -> Self

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

source§

impl<T: TaffyAuto> Point<T>

source

pub const fn auto() -> Self

Returns a Point where both the x and y values are the auto value of the contained type (e.g. Dimension::Auto or LengthPercentageAuto::Auto)

source§

impl<T: TaffyMinContent> Point<T>

source

pub const fn min_content() -> Self

Returns a Point where both the x and y values are the min_content value of the contained type (e.g. Dimension::Auto or LengthPercentageAuto::Auto)

source§

impl<T: TaffyMaxContent> Point<T>

source

pub const fn max_content() -> Self

Returns a Point where both the x and y values are the max_content value of the contained type (e.g. Dimension::Auto or LengthPercentageAuto::Auto)

source§

impl<T: TaffyFitContent> Point<T>

source

pub fn fit_content(argument: LengthPercentage) -> Self

Returns a Point with x and y set to the same fit-content(…) value with the given argument.

source§

impl<T: FromLength> Point<T>

source

pub fn length<Input: Into<f32> + Copy>(value: Input) -> Self

Returns a Point where x and y values are the same given absolute length

source§

impl<T: FromPercent> Point<T>

source

pub fn percent<Input: Into<f32> + Copy>(percent_value: Input) -> Self

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

Trait Implementations§

source§

impl<U, T: Add<U>> Add<Point<U>> for Point<T>

§

type Output = Point<<T as Add<U>>::Output>

The resulting type after applying the + operator.
source§

fn add(self, rhs: Point<U>) -> Self::Output

Performs the + operation. Read more
source§

impl<T: Clone> Clone for Point<T>

source§

fn clone(&self) -> Point<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> Debug for Point<T>

source§

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

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

impl<T: Default> Default for Point<T>

source§

fn default() -> Point<T>

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

impl<T> From<Point<T>> for Size<T>

source§

fn from(value: Point<T>) -> Self

Converts to this type from the input type.
source§

impl<T: FromLength> FromLength for Point<T>

source§

fn from_length<Input: Into<f32> + Copy>(value: Input) -> Self

Converts into an Into<f32> into Self
source§

impl<T: FromPercent> FromPercent for Point<T>

source§

fn from_percent<Input: Into<f32> + Copy>(percent: Input) -> Self

Converts into an Into<f32> into Self
source§

impl<T: PartialEq> PartialEq for Point<T>

source§

fn eq(&self, other: &Point<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> TaffyAuto for Point<T>

source§

const AUTO: Point<T> = _

The auto value for type implementing TaffyAuto
source§

impl<T: TaffyFitContent> TaffyFitContent for Point<T>

source§

fn fit_content(argument: LengthPercentage) -> Self

Converts a LengthPercentage into Self
source§

impl<T: TaffyMaxContent> TaffyMaxContent for Point<T>

source§

const MAX_CONTENT: Point<T> = _

The max_content value for type implementing TaffyZero
source§

impl<T: TaffyMinContent> TaffyMinContent for Point<T>

source§

const MIN_CONTENT: Point<T> = _

The min_content value for type implementing TaffyZero
source§

impl<T: TaffyZero> TaffyZero for Point<T>

source§

const ZERO: Point<T> = _

The zero value for type implementing TaffyZero
source§

impl<T: Copy> Copy for Point<T>

source§

impl<T: Eq> Eq for Point<T>

source§

impl<T> StructuralPartialEq for Point<T>

Auto Trait Implementations§

§

impl<T> Freeze for Point<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Point<T>
where T: RefUnwindSafe,

§

impl<T> Send for Point<T>
where T: Send,

§

impl<T> Sync for Point<T>
where T: Sync,

§

impl<T> Unpin for Point<T>
where T: Unpin,

§

impl<T> UnwindSafe for Point<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: Copy,

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<T> CloneToUninit for T
where T: Clone,

source§

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