#[repr(C)]pub struct LayoutRect {
pub origin: LayoutPoint,
pub size: LayoutSize,
}Expand description
Only used for calculations: Rectangle (x, y, width, height) in layout space.
Fields§
§origin: LayoutPoint§size: LayoutSizeImplementations§
Source§impl LayoutRect
impl LayoutRect
pub const fn new(origin: LayoutPoint, size: LayoutSize) -> Self
pub const fn zero() -> Self
pub const fn max_x(&self) -> isize
pub const fn min_x(&self) -> isize
pub const fn max_y(&self) -> isize
pub const fn min_y(&self) -> isize
pub const fn width(&self) -> isize
pub const fn height(&self) -> isize
pub const fn contains(&self, other: &LayoutPoint) -> bool
pub fn contains_f32(&self, other_x: f32, other_y: f32) -> bool
Sourcepub const fn hit_test(&self, other: &LayoutPoint) -> Option<LayoutPoint>
pub const fn hit_test(&self, other: &LayoutPoint) -> Option<LayoutPoint>
Like contains(), but returns the (x, y) offset of the hit point
relative to the rectangle origin. Unlike contains(), points exactly
on the boundary are excluded (returns None).
Sourcepub fn union(rects: LayoutRectVecSlice) -> OptionLayoutRect
pub fn union(rects: LayoutRectVecSlice) -> OptionLayoutRect
Returns the bounding rectangle that covers every rectangle in the slice,
or OptionLayoutRect::None if the slice is empty.
Sourcepub const fn contains_rect(&self, b: &LayoutRect) -> bool
pub const fn contains_rect(&self, b: &LayoutRect) -> bool
Returns true if b is fully contained inside self.
Trait Implementations§
Source§impl Clone for LayoutRect
impl Clone for LayoutRect
Source§fn clone(&self) -> LayoutRect
fn clone(&self) -> LayoutRect
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LayoutRect
impl Debug for LayoutRect
Source§impl Display for LayoutRect
impl Display for LayoutRect
Source§impl Extend<LayoutRect> for LayoutRectVec
impl Extend<LayoutRect> for LayoutRectVec
Source§fn extend<T: IntoIterator<Item = LayoutRect>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = LayoutRect>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl FromIterator<LayoutRect> for LayoutRectVec
impl FromIterator<LayoutRect> for LayoutRectVec
Source§fn from_iter<T>(iter: T) -> Selfwhere
T: IntoIterator<Item = LayoutRect>,
fn from_iter<T>(iter: T) -> Selfwhere
T: IntoIterator<Item = LayoutRect>,
Creates a value from an iterator. Read more
Source§impl PartialEq for LayoutRect
impl PartialEq for LayoutRect
Source§fn eq(&self, other: &LayoutRect) -> bool
fn eq(&self, other: &LayoutRect) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for LayoutRect
impl PartialOrd for LayoutRect
impl Copy for LayoutRect
impl StructuralPartialEq for LayoutRect
Auto Trait Implementations§
impl Freeze for LayoutRect
impl RefUnwindSafe for LayoutRect
impl Send for LayoutRect
impl Sync for LayoutRect
impl Unpin for LayoutRect
impl UnsafeUnpin for LayoutRect
impl UnwindSafe for LayoutRect
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
Mutably borrows from an owned value. Read more