Struct Rect
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§
§impl<T> Rect<T>where
T: Add,
impl<T> Rect<T>where
T: Add,
pub 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
§impl<T> Rect<T>
impl<T> Rect<T>
pub 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>.
pub 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
pub 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
§impl<T, U> Rect<T>
impl<T, U> Rect<T>
pub fn horizontal_axis_sum(&self) -> U
pub fn horizontal_axis_sum(&self) -> U
The sum of Rect.start and Rect.end
This is typically used when computing total padding.
NOTE: this is not the width of the rectangle.
pub fn vertical_axis_sum(&self) -> U
pub fn vertical_axis_sum(&self) -> U
The sum of Rect.top and Rect.bottom
This is typically used when computing total padding.
NOTE: this is not the height of the rectangle.
§impl<T> Rect<T>where
T: TaffyMinContent,
impl<T> Rect<T>where
T: TaffyMinContent,
pub 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)
§impl<T> Rect<T>where
T: TaffyMaxContent,
impl<T> Rect<T>where
T: TaffyMaxContent,
pub 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)
§impl<T> Rect<T>where
T: TaffyFitContent,
impl<T> Rect<T>where
T: TaffyFitContent,
pub 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))
§impl<T> Rect<T>where
T: FromLength,
impl<T> Rect<T>where
T: FromLength,
Trait Implementations§
§impl<T> FromLength for Rect<T>where
T: FromLength,
impl<T> FromLength for Rect<T>where
T: FromLength,
§impl<T> FromPercent for Rect<T>where
T: FromPercent,
impl<T> FromPercent for Rect<T>where
T: FromPercent,
§impl<In, Out, T> ResolveOrZero<Size<In>, Rect<Out>> for Rect<T>
impl<In, Out, T> ResolveOrZero<Size<In>, Rect<Out>> for Rect<T>
§impl<T> TaffyFitContent for Rect<T>where
T: TaffyFitContent,
impl<T> TaffyFitContent for Rect<T>where
T: TaffyFitContent,
§fn fit_content(argument: LengthPercentage) -> Rect<T>
fn fit_content(argument: LengthPercentage) -> Rect<T>
§impl<T> TaffyMaxContent for Rect<T>where
T: TaffyMaxContent,
impl<T> TaffyMaxContent for Rect<T>where
T: TaffyMaxContent,
§const MAX_CONTENT: Rect<T>
const MAX_CONTENT: Rect<T>
§impl<T> TaffyMinContent for Rect<T>where
T: TaffyMinContent,
impl<T> TaffyMinContent for Rect<T>where
T: TaffyMinContent,
§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> UnsafeUnpin for Rect<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Rect<T>where
T: UnwindSafe,
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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