pub struct DebugRect {
pub x: f32,
pub y: f32,
pub w: f32,
pub h: f32,
}Expand description
Serializable logical-pixel rectangle.
Edges are inclusive for point picking. Width and height are stored verbatim; snapshot collection normally supplies non-negative layout values.
§Examples
use ailloli_ui_devtools_core::DebugRect;
let rect = DebugRect { x: 10.0, y: 20.0, w: 30.0, h: 40.0 };
assert_eq!((rect.right(), rect.bottom()), (40.0, 60.0));Fields§
§x: f32Left edge in logical pixels.
y: f32Top edge in logical pixels.
w: f32Width in logical pixels.
h: f32Height in logical pixels.
Implementations§
Source§impl DebugRect
Edge and containment helpers for debug rectangles.
impl DebugRect
Edge and containment helpers for debug rectangles.
Sourcepub fn right(self) -> f32
pub fn right(self) -> f32
Returns x + w without clamping or overflow handling.
§Examples
use ailloli_ui_devtools_core::DebugRect;
assert_eq!(DebugRect { x: 2.0, y: 0.0, w: 3.0, h: 1.0 }.right(), 5.0);Sourcepub fn bottom(self) -> f32
pub fn bottom(self) -> f32
Returns y + h without clamping or overflow handling.
§Examples
use ailloli_ui_devtools_core::DebugRect;
assert_eq!(DebugRect { x: 0.0, y: 4.0, w: 1.0, h: 6.0 }.bottom(), 10.0);Sourcepub fn contains(self, point: DebugPoint) -> bool
pub fn contains(self, point: DebugPoint) -> bool
Returns whether point lies on or within all four edges.
§Examples
use ailloli_ui_devtools_core::{DebugPoint, DebugRect};
let rect = DebugRect { x: 0.0, y: 0.0, w: 10.0, h: 5.0 };
assert!(rect.contains(DebugPoint { x: 10.0, y: 5.0 }));
assert!(!rect.contains(DebugPoint { x: 10.1, y: 5.0 }));Trait Implementations§
Source§impl<'de> Deserialize<'de> for DebugRect
impl<'de> Deserialize<'de> for DebugRect
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for DebugRect
impl StructuralPartialEq for DebugRect
Auto Trait Implementations§
impl Freeze for DebugRect
impl RefUnwindSafe for DebugRect
impl Send for DebugRect
impl Sync for DebugRect
impl Unpin for DebugRect
impl UnwindSafe for DebugRect
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
§fn into_click_action(self) -> ClickAction<A>
fn into_click_action(self) -> ClickAction<A>
Implements the into_click_action helper used by this module.