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

A rectangle defined by left, top, right and bottom edges.

Can have zero width and/or height. But not a negative one.

Guarantees

  • All values are finite.
  • Left edge is <= right.
  • Top edge is <= bottom.
  • Width and height are <= f32::MAX.

Implementations

Creates new Rect.

Creates new Rect.

Returns the left edge.

Returns the top edge.

Returns the right edge.

Returns the bottom edge.

Returns rect’s X position.

Returns rect’s Y position.

Returns rect’s width.

Returns rect’s height.

Converts into an IntRect by adding 0.5 and discarding the fractional portion.

Width and height are guarantee to be >= 1.

Converts into an IntRect rounding outwards.

Width and height are guarantee to be >= 1.

Returns an intersection of two rectangles.

Returns None otherwise.

Creates a Rect from Point array.

Returns None if count is zero or if Point array contains an infinity or NaN.

Insets the rectangle by the specified offset.

Outsets the rectangle by the specified offset.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. 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.

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.