pub struct GridRectangle { /* private fields */ }Expand description
represents a rectangle of regions defined by the lower left (minimum coordinates)
and upper right (maximum coordinates) corners in GridCoordinates
Implementations§
Source§impl GridRectangle
impl GridRectangle
Sourcepub fn new(corner1: GridCoordinates, corner2: GridCoordinates) -> Self
pub fn new(corner1: GridCoordinates, corner2: GridCoordinates) -> Self
creates a new GridRectangle given any two corners
Sourcepub fn expanded_west(&self, by: u16) -> Self
pub fn expanded_west(&self, by: u16) -> Self
returns a new GridRectangle extended by by regions on the west (-x) side
Saturates at the western edge of the grid (x = 0).
Sourcepub fn expanded_east(&self, by: u16) -> Self
pub fn expanded_east(&self, by: u16) -> Self
returns a new GridRectangle extended by by regions on the east (+x) side
Saturates at the eastern edge of the grid (x = u16::MAX).
Sourcepub fn expanded_south(&self, by: u16) -> Self
pub fn expanded_south(&self, by: u16) -> Self
returns a new GridRectangle extended by by regions on the south (-y) side
Saturates at the southern edge of the grid (y = 0).
Sourcepub fn expanded_north(&self, by: u16) -> Self
pub fn expanded_north(&self, by: u16) -> Self
returns a new GridRectangle extended by by regions on the north (+y) side
Saturates at the northern edge of the grid (y = u16::MAX).
Trait Implementations§
Source§impl Clone for GridRectangle
impl Clone for GridRectangle
Source§fn clone(&self) -> GridRectangle
fn clone(&self) -> GridRectangle
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 GridRectangle
impl Debug for GridRectangle
impl Eq for GridRectangle
Source§impl GridRectangleLike for GridRectangle
impl GridRectangleLike for GridRectangle
Source§fn grid_rectangle(&self) -> GridRectangle
fn grid_rectangle(&self) -> GridRectangle
the
GridRectangle represented by this map like imageSource§fn lower_left_corner(&self) -> GridCoordinates
fn lower_left_corner(&self) -> GridCoordinates
returns the lower left corner of the rectangle
Source§fn upper_right_corner(&self) -> GridCoordinates
fn upper_right_corner(&self) -> GridCoordinates
returns the upper right corner of the rectangle
Source§fn x_range(&self) -> RangeInclusive<u16>
fn x_range(&self) -> RangeInclusive<u16>
returns a range for the region x coordinates of this rectangle
Source§fn y_range(&self) -> RangeInclusive<u16>
fn y_range(&self) -> RangeInclusive<u16>
returns a range for the region y coordinates of this rectangle
Source§fn lower_right_corner(&self) -> GridCoordinates
fn lower_right_corner(&self) -> GridCoordinates
returns the lower right corner of the rectangle
Source§fn upper_left_corner(&self) -> GridCoordinates
fn upper_left_corner(&self) -> GridCoordinates
returns the upper left corner of the rectangle
Source§fn contains(&self, grid_coordinates: &GridCoordinates) -> bool
fn contains(&self, grid_coordinates: &GridCoordinates) -> bool
checks if a given set of
GridCoordinates is within this GridRectangleSource§fn intersect<O>(&self, other: &O) -> Option<GridRectangle>where
O: GridRectangleLike,
fn intersect<O>(&self, other: &O) -> Option<GridRectangle>where
O: GridRectangleLike,
returns a new
GridRectangle which is the area where this GridRectangle
and another intersect each other or None if there is no intersectionSource§fn pps_hud_config(&self) -> String
fn pps_hud_config(&self) -> String
returns a PPS HUD description string for this
GridRectangle Read moreSource§impl PartialEq for GridRectangle
impl PartialEq for GridRectangle
Source§fn eq(&self, other: &GridRectangle) -> bool
fn eq(&self, other: &GridRectangle) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for GridRectangle
Auto Trait Implementations§
impl Freeze for GridRectangle
impl RefUnwindSafe for GridRectangle
impl Send for GridRectangle
impl Sync for GridRectangle
impl Unpin for GridRectangle
impl UnsafeUnpin for GridRectangle
impl UnwindSafe for GridRectangle
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