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: TThis 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: TThis 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: TThis can represent either the y-coordinate of the top edge, or the amount of padding on the top side.
bottom: TThis can represent either the y-coordinate of the bottom edge, or the amount of padding on the bottom side.
Implementations§
Source§impl<T> Rect<T>where
T: Add,
impl<T> Rect<T>where
T: Add,
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<T> Rect<T>where
T: TaffyMinContent,
impl<T> Rect<T>where
T: TaffyMinContent,
Sourcepub const fn min_content() -> Rect<T>
pub const fn min_content() -> Rect<T>
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> Rect<T>where
T: TaffyMaxContent,
impl<T> Rect<T>where
T: TaffyMaxContent,
Sourcepub const fn max_content() -> Rect<T>
pub const fn max_content() -> Rect<T>
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> Rect<T>where
T: TaffyFitContent,
impl<T> Rect<T>where
T: TaffyFitContent,
Sourcepub fn fit_content(argument: LengthPercentage) -> Rect<T>
pub fn fit_content(argument: LengthPercentage) -> Rect<T>
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> Rect<T>where
T: FromLength,
impl<T> Rect<T>where
T: FromLength,
Trait Implementations§
Source§impl<T> FromLength for Rect<T>where
T: FromLength,
impl<T> FromLength for Rect<T>where
T: FromLength,
Source§impl<T> FromPercent for Rect<T>where
T: FromPercent,
impl<T> FromPercent for Rect<T>where
T: FromPercent,
Source§impl<T> TaffyFitContent for Rect<T>where
T: TaffyFitContent,
impl<T> TaffyFitContent for Rect<T>where
T: TaffyFitContent,
Source§fn fit_content(argument: LengthPercentage) -> Rect<T>
fn fit_content(argument: LengthPercentage) -> Rect<T>
Source§impl<T> TaffyMaxContent for Rect<T>where
T: TaffyMaxContent,
impl<T> TaffyMaxContent for Rect<T>where
T: TaffyMaxContent,
Source§const MAX_CONTENT: Rect<T>
const MAX_CONTENT: Rect<T>
Source§impl<T> TaffyMinContent for Rect<T>where
T: TaffyMinContent,
impl<T> TaffyMinContent for Rect<T>where
T: TaffyMinContent,
Source§const MIN_CONTENT: Rect<T>
const MIN_CONTENT: Rect<T>
impl<T> Copy for Rect<T>where
T: Copy,
impl<T> Eq for Rect<T>where
T: Eq,
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§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.