pub struct Rect {
pub x: i32,
pub y: i32,
pub w: i32,
pub h: i32,
}Fields§
§x: i32§y: i32§w: i32§h: i32Implementations§
Source§impl Rect
impl Rect
pub const fn new(x: i32, y: i32, w: i32, h: i32) -> Self
pub const fn contains(&self, p: Point) -> bool
Sourcepub fn clamp_point(&self, p: Point) -> Point
pub fn clamp_point(&self, p: Point) -> Point
The nearest point inside this rect.
The upper bounds are inclusive-exclusive to match contains, so a
clamped point always satisfies it — a zero-sized rect is the one
exception, and it clamps to the origin corner.
Trait Implementations§
impl Copy for Rect
Source§impl<'de> Deserialize<'de> for Rect
impl<'de> Deserialize<'de> for Rect
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 Eq for Rect
impl StructuralPartialEq for Rect
Auto Trait Implementations§
impl Freeze for Rect
impl RefUnwindSafe for Rect
impl Send for Rect
impl Sync for Rect
impl Unpin for Rect
impl UnsafeUnpin for Rect
impl UnwindSafe for Rect
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<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.