#[repr(C)]pub struct LogicalRect {
pub origin: LogicalPosition,
pub size: LogicalSize,
}Expand description
An axis-aligned rectangle in logical (DPI-independent) coordinates.
Fields§
§origin: LogicalPosition§size: LogicalSizeImplementations§
Source§impl LogicalRect
impl LogicalRect
pub const fn zero() -> Self
pub const fn new(origin: LogicalPosition, size: LogicalSize) -> Self
Sourcepub fn scale_for_dpi(&mut self, scale_factor: f32)
pub fn scale_for_dpi(&mut self, scale_factor: f32)
Scales all coordinates in-place by the given DPI scale factor.
Sourcepub fn intersects(&self, other: Self) -> bool
pub fn intersects(&self, other: Self) -> bool
Returns whether this rectangle intersects with another rectangle
Sourcepub fn contains(&self, point: LogicalPosition) -> bool
pub fn contains(&self, point: LogicalPosition) -> bool
Returns whether this rectangle contains the given point
Sourcepub fn hit_test(&self, other: &LogicalPosition) -> Option<LogicalPosition>
pub fn hit_test(&self, other: &LogicalPosition) -> Option<LogicalPosition>
Same as contains(), but returns the (x, y) offset of the hit point
On a regular computer this function takes ~3.2ns to run
Trait Implementations§
Source§impl Clone for LogicalRect
impl Clone for LogicalRect
Source§fn clone(&self) -> LogicalRect
fn clone(&self) -> LogicalRect
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 LogicalRect
impl Debug for LogicalRect
Source§impl Default for LogicalRect
impl Default for LogicalRect
Source§fn default() -> LogicalRect
fn default() -> LogicalRect
Returns the “default value” for a type. Read more
Source§impl Display for LogicalRect
impl Display for LogicalRect
Source§impl FromIterator<LogicalRect> for LogicalRectVec
impl FromIterator<LogicalRect> for LogicalRectVec
Source§fn from_iter<T>(iter: T) -> Selfwhere
T: IntoIterator<Item = LogicalRect>,
fn from_iter<T>(iter: T) -> Selfwhere
T: IntoIterator<Item = LogicalRect>,
Creates a value from an iterator. Read more
Source§impl Hash for LogicalRect
impl Hash for LogicalRect
Source§impl Ord for LogicalRect
impl Ord for LogicalRect
Source§fn cmp(&self, other: &LogicalRect) -> Ordering
fn cmp(&self, other: &LogicalRect) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for LogicalRect
impl PartialEq for LogicalRect
Source§fn eq(&self, other: &LogicalRect) -> bool
fn eq(&self, other: &LogicalRect) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for LogicalRect
impl PartialOrd for LogicalRect
impl Copy for LogicalRect
impl Eq for LogicalRect
impl StructuralPartialEq for LogicalRect
Auto Trait Implementations§
impl Freeze for LogicalRect
impl RefUnwindSafe for LogicalRect
impl Send for LogicalRect
impl Sync for LogicalRect
impl Unpin for LogicalRect
impl UnsafeUnpin for LogicalRect
impl UnwindSafe for LogicalRect
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