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_length(start: f32, end: f32, top: f32, bottom: f32) -> Self
pub const fn from_length(start: f32, end: f32, top: f32, bottom: f32) -> Self
Create a new Rect with Dimension::Length
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 Rect 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 Rect 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::Length(2.1))
source§impl<T: FromLength> Rect<T>
impl<T: FromLength> Rect<T>
Trait Implementations§
source§impl<T: FromLength> FromLength for Rect<T>
impl<T: FromLength> FromLength for Rect<T>
source§impl<T: FromPercent> FromPercent for Rect<T>
impl<T: FromPercent> FromPercent for Rect<T>
source§impl<T: TaffyFitContent> TaffyFitContent for Rect<T>
impl<T: TaffyFitContent> TaffyFitContent for Rect<T>
source§fn fit_content(argument: LengthPercentage) -> Self
fn fit_content(argument: LengthPercentage) -> Self
source§impl<T: TaffyMaxContent> TaffyMaxContent for Rect<T>
impl<T: TaffyMaxContent> TaffyMaxContent for Rect<T>
source§const MAX_CONTENT: Rect<T> = _
const MAX_CONTENT: Rect<T> = _
source§impl<T: TaffyMinContent> TaffyMinContent for Rect<T>
impl<T: TaffyMinContent> TaffyMinContent for Rect<T>
source§const MIN_CONTENT: Rect<T> = _
const MIN_CONTENT: Rect<T> = _
impl<T: Copy> Copy for Rect<T>
impl<T: Eq> Eq for Rect<T>
impl<T> StructuralPartialEq for Rect<T>
Auto Trait Implementations§
impl<T> Freeze for Rect<T>where
T: Freeze,
impl<T> RefUnwindSafe for Rect<T>where
T: RefUnwindSafe,
impl<T> Send for Rect<T>where
T: Send,
impl<T> Sync for Rect<T>where
T: Sync,
impl<T> Unpin for Rect<T>where
T: Unpin,
impl<T> UnwindSafe for Rect<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
)