pub struct Rect { /* private fields */ }
Expand description

A non-empty rectangle on the 2D grid.

Implementations

Creates a new Rect around a single point.

The size will be (1, 1).

Creates a new Rect with the given position and size.

The minimum size will (1, 1).

Creates a new Rect from two corners.

It can be any two opposite corners.

Grow this rectangle if necessary to include other.

Returns a new rectangle that includes both self and other.

Returns the start and end coordinate of one side of this rectangle.

Both start and end are inclusive.

Returns the coordinate of the given edge.

All edges are inclusive.

Adds the given offset to this rectangle.

Returns the size of the rectangle.

Returns the width of the rectangle.

Returns the height of the rectangle.

Returns the top-left corner.

This is inclusive.

Returns the bottom-right corner.

This is inclusive.

Returns the top-right corner.

This is inclusive.

Returns the bottom-left corner.

This is inclusive.

Returns the Y value of the top edge of the rectangle.

This is inclusive.

Returns the X value of the left edge of the rectangle.

This is inclusive.

Returns the X value of the right edge of the rectangle.

This is inclusive.

Returns the Y value of the botton edge of the rectangle.

This is inclusive.

Returns the surface (number of cells) covered by the rectangle.

Checks if a point is in self.

Trait Implementations

The resulting type after applying the + operator.

Performs the + operation. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Calls the given closure and return the result. Read more

Calls the given closure on self.

Calls the given closure on self.

Calls the given closure if condition == true.