pub struct Region<U: Unsigned + Copy = u16> { /* private fields */ }Expand description
A square region defined by a bottom-left point and a size, in integer units.
Implementations§
Source§impl<U: Unsigned + NumCast + Copy> Region<U>
impl<U: Unsigned + NumCast + Copy> Region<U>
Sourcepub fn new(x: U, y: U, size: U) -> Self
pub fn new(x: U, y: U, size: U) -> Self
Create a new region with the given bottom-left point coordinates and size.
pub fn size_as<N: NumCast>(&self) -> N
Sourcepub fn is_unit(&self, pixel_size: u8) -> bool
pub fn is_unit(&self, pixel_size: u8) -> bool
Determine if this region represents the smallest possible unit or pixel size.
Sourcepub fn contains_upoint<P>(&self, point: P) -> bool
pub fn contains_upoint<P>(&self, point: P) -> bool
Determine if the given point is contained within this region.
Sourcepub fn contains_ipoint<P>(&self, point: P) -> bool
pub fn contains_ipoint<P>(&self, point: P) -> bool
Determine if the given point is contained within this region.
Sourcepub fn quadrant_for_upoint<P>(&self, point: P) -> Quadrant
pub fn quadrant_for_upoint<P>(&self, point: P) -> Quadrant
Obtain the quadrant for the given point in relation to the center of this region.
Sourcepub fn quadrant_for_ipoint<P>(&self, point: P) -> Quadrant
pub fn quadrant_for_ipoint<P>(&self, point: P) -> Quadrant
Obtain the quadrant for the given point in relation to the center of this region.
pub fn intersect(&self, other: &URect) -> URect
pub fn as_urect(&self) -> URect
Trait Implementations§
impl<U: Eq + Unsigned + Copy> Eq for Region<U>
impl<U: Unsigned + Copy> StructuralPartialEq for Region<U>
Auto Trait Implementations§
impl<U> Freeze for Region<U>where
U: Freeze,
impl<U> RefUnwindSafe for Region<U>where
U: RefUnwindSafe,
impl<U> Send for Region<U>where
U: Send,
impl<U> Sync for Region<U>where
U: Sync,
impl<U> Unpin for Region<U>where
U: Unpin,
impl<U> UnwindSafe for Region<U>where
U: 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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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>
Converts
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>
Converts
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