Struct pixel_widgets::layout::Rectangle[][src]

pub struct Rectangle {
    pub left: f32,
    pub top: f32,
    pub right: f32,
    pub bottom: f32,
}
Expand description

A rectangle

Fields

left: f32top: f32right: f32bottom: f32

Implementations

Convert a rectangle to device coordinates ([-1.0, 1.0]) using a Viewport. (-1, -1) is the top left corner (0, 0), where (1, 1) is the bottom right corner (viewport.width(), viewport.height()).

Return a zero size rectangle

Construct a new rectangle with (0, 0) as (left, top), and w, h as (right, bottom)

Construct a new rectangle from a position and a size

Returns true when the queried point is inside the rectangle

Returns the rectangle that is covered both by self and other. None is returned if the rectangles do not overlap.

Return a point within this rectangle. The point should be in [0, 1] range.

Return a rectangle with all fields rounded

Apply a translation the the rectangle

Increase the size of the rectangle on the right and bottom side.

Decrease the size of the rectangle on all sides

Grow the rectangle on all sides

Return a rectangle with the same size, but positioned at the origin

The width of the rectangle

The height of the rectangle

Apply a margin to the rectangle

Apply padding to the rectangle

Return the smallest rectangle that covers both self and other

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

Performs the conversion.

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

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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.