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<T> Point<T>
impl<T> Point<T>
sourcepub 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>
.
sourcepub 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
sourcepub 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
source§impl<T: TaffyMinContent> Point<T>
impl<T: TaffyMinContent> Point<T>
sourcepub const fn min_content() -> Self
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>
impl<T: TaffyMaxContent> Point<T>
sourcepub const fn max_content() -> Self
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>
impl<T: TaffyFitContent> Point<T>
sourcepub fn fit_content(argument: LengthPercentage) -> Self
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>
impl<T: FromLength> Point<T>
Trait Implementations§
source§impl<'de, T> Deserialize<'de> for Point<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Point<T>where
T: Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl<T: FromLength> FromLength for Point<T>
impl<T: FromLength> FromLength for Point<T>
source§impl<T: FromPercent> FromPercent for Point<T>
impl<T: FromPercent> FromPercent for Point<T>
source§impl<T: TaffyFitContent> TaffyFitContent for Point<T>
impl<T: TaffyFitContent> TaffyFitContent for Point<T>
source§fn fit_content(argument: LengthPercentage) -> Self
fn fit_content(argument: LengthPercentage) -> Self
source§impl<T: TaffyMaxContent> TaffyMaxContent for Point<T>
impl<T: TaffyMaxContent> TaffyMaxContent for Point<T>
source§const MAX_CONTENT: Point<T> = _
const MAX_CONTENT: Point<T> = _
source§impl<T: TaffyMinContent> TaffyMinContent for Point<T>
impl<T: TaffyMinContent> TaffyMinContent for Point<T>
source§const MIN_CONTENT: Point<T> = _
const MIN_CONTENT: Point<T> = _
impl<T: Copy> Copy for Point<T>
impl<T: Eq> Eq for Point<T>
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
)