Struct shapes::Rect

source ·
pub struct Rect {
    pub pos: Point,
    pub size: Size,
}
Expand description

A rectangle.

Fields§

§pos: Point

The position of the top left corner of the rectangle.

§size: Size

The width and height of the rectangle.

Implementations§

Returns the position of the bottom side of the rectangle.

Computes a rectangle with quadruple the surface area of self and with center (self.x, self.y).

Compute whether or not the point is inside the rectangle.

Create a rectangle that circumscribes the given circle.

Create a square rectangle with sides of length len and top left corner at pos.

Returns the position of the left side of the rectangle.

Computes a rectangle whose perimeter forms the inside edge of margin with size m for self.

Computes a rectangle translated (slid) in the direction of the vector a distance relative to the size of the rectangle. For example, self.relative([1.0, 1.0]) returns a rectangle one rectangle to the right and down from the original.

Returns the position of the right side of the rectangle.

Computes a scaled rectangle with the same position as self.

Returns the position of the top side of the rectangle.

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

Creates a rectangle from an array.

Creates a rectangle from the position of its top left corner and its size.

Converts to this type from the input type.
Converts to this type from the input type.

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.