pub struct Rect { /* private fields */ }
Implementations
sourceimpl Rect
impl Rect
sourcepub fn new<P1: Into<Coord>, P2: Into<Coord>>(
start: P1,
end: P2,
draw_type: DrawType
) -> Self
pub fn new<P1: Into<Coord>, P2: Into<Coord>>(
start: P1,
end: P2,
draw_type: DrawType
) -> Self
Creates a new Rect
If necessary the points will be swapped so start_x < end_x and start_y < end_y
pub fn width(&self) -> isize
pub fn height(&self) -> isize
pub fn topleft(&self) -> Coord
pub fn bottomright(&self) -> Coord
sourcepub fn union(&self, other: &Rect) -> Rect
pub fn union(&self, other: &Rect) -> Rect
Union this rect and another, the result will contain both rectangles Generally, this means the result will be bigger than self
sourcepub fn intersect(&self, other: &Rect) -> Rect
pub fn intersect(&self, other: &Rect) -> Rect
Intersect this rect and another, the result will contain the area covered by both rectangles Generally, this means the result will be smaller than self
Returns
self if rectangles do not intersect
pub fn intersects(&self, other: &Rect) -> bool
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Rect
impl<'de> Deserialize<'de> for Rect
sourcefn 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
sourceimpl PartialEq<Rect> for Rect
impl PartialEq<Rect> for Rect
impl Eq for Rect
impl StructuralEq for Rect
impl StructuralPartialEq for Rect
Auto Trait Implementations
impl RefUnwindSafe for Rect
impl Send for Rect
impl Sync for Rect
impl Unpin for Rect
impl UnwindSafe for Rect
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more