pub struct Rectangle {
pub position: Position,
pub size: USize,
}Expand description
Represents a rectangle, using a position and size.
Fields§
§position: PositionThe location of the rectangle’s upper-left corner
size: USizeThe width and height of the rectangle
Implementations§
Source§impl Rectangle
impl Rectangle
Sourcepub fn new(position: Position, size: USize) -> Self
pub fn new(position: Position, size: USize) -> Self
Returns a new rectangle with the given position and size
Sourcepub fn new_from_raw(x: i32, y: i32, width: u32, height: u32) -> Self
pub fn new_from_raw(x: i32, y: i32, width: u32, height: u32) -> Self
Returns a new rectangle with the given raw position and size values
Sourcepub fn contains_position(&self, position: Position) -> bool
pub fn contains_position(&self, position: Position) -> bool
Returns whether a given position is within the rectangle or not
Sourcepub fn contains_fposition(&self, position: FPosition) -> bool
pub fn contains_fposition(&self, position: FPosition) -> bool
Returns whether a given position is within the rectangle or not
Trait Implementations§
impl Copy for Rectangle
impl Eq for Rectangle
impl StructuralPartialEq for Rectangle
Auto Trait Implementations§
impl Freeze for Rectangle
impl RefUnwindSafe for Rectangle
impl Send for Rectangle
impl Sync for Rectangle
impl Unpin for Rectangle
impl UnwindSafe for Rectangle
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