pub struct Rect<T> {
pub left: T,
pub right: T,
pub top: T,
pub bottom: T,
}
Expand description
An axis-aligned UI rectangle
Fields§
§left: T
This can represent either the x-coordinate of the starting edge, or the amount of padding on the starting side.
The starting edge is the left edge when working with LTR text, and the right edge when working with RTL text.
right: T
This can represent either the x-coordinate of the ending edge, or the amount of padding on the ending side.
The ending edge is the right edge when working with LTR text, and the left edge when working with RTL text.
top: T
This can represent either the y-coordinate of the top edge, or the amount of padding on the top side.
bottom: T
This can represent either the y-coordinate of the bottom edge, or the amount of padding on the bottom side.
Implementations§
source§impl<T: Add> Rect<T>
impl<T: Add> Rect<T>
sourcepub fn grid_axis_sum(self, axis: AbsoluteAxis) -> <T as Add>::Output
pub fn grid_axis_sum(self, axis: AbsoluteAxis) -> <T as Add>::Output
Get either the width or height depending on the AbsoluteAxis passed in
source§impl<T> Rect<T>
impl<T> Rect<T>
sourcepub fn map<R, F>(self, f: F) -> Rect<R>where
F: Fn(T) -> R,
pub fn map<R, F>(self, f: F) -> Rect<R>where
F: Fn(T) -> R,
Applies the function f
to the left, right, top, and bottom properties
This is used to transform a Rect<T>
into a Rect<R>
.
sourcepub fn horizontal_components(self) -> Line<T>
pub fn horizontal_components(self) -> Line<T>
Returns a Line<T>
representing the left and right properties of the Rect
sourcepub fn vertical_components(self) -> Line<T>
pub fn vertical_components(self) -> Line<T>
Returns a Line<T>
containing the top and bottom properties of the Rect
source§impl Rect<Dimension>
impl Rect<Dimension>
sourcepub const fn from_points(start: f32, end: f32, top: f32, bottom: f32) -> Self
pub const fn from_points(start: f32, end: f32, top: f32, bottom: f32) -> Self
Create a new Rect with Dimension::Points
sourcepub const fn from_percent(start: f32, end: f32, top: f32, bottom: f32) -> Self
pub const fn from_percent(start: f32, end: f32, top: f32, bottom: f32) -> Self
Create a new Rect with Dimension::Percent
source§impl<T: TaffyMinContent> Rect<T>
impl<T: TaffyMinContent> Rect<T>
sourcepub const fn min_content() -> Self
pub const fn min_content() -> Self
Returns a Size where the left, right, top, and bottom values are all the min_content value of the contained type (e.g. Dimension::Auto or LengthPercentageAuto::Auto)
source§impl<T: TaffyMaxContent> Rect<T>
impl<T: TaffyMaxContent> Rect<T>
sourcepub const fn max_content() -> Self
pub const fn max_content() -> Self
Returns a Size where the left, right, top, and bottom values are all the max_content value of the contained type (e.g. Dimension::Auto or LengthPercentageAuto::Auto)
source§impl<T: TaffyFitContent> Rect<T>
impl<T: TaffyFitContent> Rect<T>
sourcepub fn fit_content(argument: LengthPercentage) -> Self
pub fn fit_content(argument: LengthPercentage) -> Self
Returns a Rect where the left, right, top and bottom values are all constant fit_content value of the contained type (e.g. 2.1, Some(2.1), or Dimension::Points(2.1))