Skip to main content

GridRectangle

Struct GridRectangle 

Source
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

Source

pub fn new(corner1: GridCoordinates, corner2: GridCoordinates) -> Self

creates a new GridRectangle given any two corners

Source

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).

Source

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).

Source

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).

Source

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

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Debug for GridRectangle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for GridRectangle

Source§

impl GridRectangleLike for GridRectangle

Source§

fn grid_rectangle(&self) -> GridRectangle

the GridRectangle represented by this map like image
Source§

fn lower_left_corner(&self) -> GridCoordinates

returns the lower left corner of the rectangle
Source§

fn upper_right_corner(&self) -> GridCoordinates

returns the upper right corner of the rectangle
Source§

fn size_x(&self) -> u16

the size of the map like image in regions in the x direction (width)
Source§

fn size_y(&self) -> u16

the size of the map like image in regions in the y direction (width)
Source§

fn x_range(&self) -> RangeInclusive<u16>

returns a range for the region x coordinates of this rectangle
Source§

fn y_range(&self) -> RangeInclusive<u16>

returns a range for the region y coordinates of this rectangle
Source§

fn lower_right_corner(&self) -> GridCoordinates

returns the lower right corner of the rectangle
Source§

fn upper_left_corner(&self) -> GridCoordinates

returns the upper left corner of the rectangle
Source§

fn contains(&self, grid_coordinates: &GridCoordinates) -> bool

checks if a given set of GridCoordinates is within this GridRectangle
Source§

fn intersect<O>(&self, other: &O) -> Option<GridRectangle>

returns a new GridRectangle which is the area where this GridRectangle and another intersect each other or None if there is no intersection
Source§

fn pps_hud_config(&self) -> String

returns a PPS HUD description string for this GridRectangle Read more
Source§

impl PartialEq for GridRectangle

Source§

fn eq(&self, other: &GridRectangle) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for GridRectangle

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.