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§
§impl<T> Point<T>
impl<T> Point<T>
pub fn map<R, F>(self, f: F) -> Point<R>where
F: Fn(T) -> R,
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>
.
pub fn get(self, axis: AbstractAxis) -> T
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
pub fn set(&mut self, axis: AbstractAxis, value: T)
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
§impl<T> Point<T>where
T: TaffyMinContent,
impl<T> Point<T>where
T: TaffyMinContent,
pub const fn min_content() -> Point<T>
pub const fn min_content() -> Point<T>
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)
§impl<T> Point<T>where
T: TaffyMaxContent,
impl<T> Point<T>where
T: TaffyMaxContent,
pub const fn max_content() -> Point<T>
pub const fn max_content() -> Point<T>
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)
§impl<T> Point<T>where
T: TaffyFitContent,
impl<T> Point<T>where
T: TaffyFitContent,
pub fn fit_content(argument: LengthPercentage) -> Point<T>
pub fn fit_content(argument: LengthPercentage) -> Point<T>
Returns a Point with x and y set to the same fit-content(…)
value
with the given argument.
§impl<T> Point<T>where
T: FromLength,
impl<T> Point<T>where
T: FromLength,
Trait Implementations§
§impl<'de, T> Deserialize<'de> for Point<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Point<T>where
T: Deserialize<'de>,
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Point<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Point<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl<T> FromLength for Point<T>where
T: FromLength,
impl<T> FromLength for Point<T>where
T: FromLength,
§impl<T> FromPercent for Point<T>where
T: FromPercent,
impl<T> FromPercent for Point<T>where
T: FromPercent,
§impl<T> Serialize for Point<T>where
T: Serialize,
impl<T> Serialize for Point<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 Point<T>where
T: TaffyFitContent,
impl<T> TaffyFitContent for Point<T>where
T: TaffyFitContent,
§fn fit_content(argument: LengthPercentage) -> Point<T>
fn fit_content(argument: LengthPercentage) -> Point<T>
§impl<T> TaffyMaxContent for Point<T>where
T: TaffyMaxContent,
impl<T> TaffyMaxContent for Point<T>where
T: TaffyMaxContent,
§const MAX_CONTENT: Point<T> = _
const MAX_CONTENT: Point<T> = _
§impl<T> TaffyMinContent for Point<T>where
T: TaffyMinContent,
impl<T> TaffyMinContent for Point<T>where
T: TaffyMinContent,
§const MIN_CONTENT: Point<T> = _
const MIN_CONTENT: Point<T> = _
impl<T> Copy for Point<T>where
T: Copy,
impl<T> Eq for Point<T>where
T: Eq,
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> 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