Enum figures::Rect[][src]

pub enum Rect<T, Unit> {
    Sized(SizedRect<T, Unit>),
    Extents(ExtentsRect<T, Unit>),
}
Expand description

A 2d rectangle. This type may internally be represented with a SizedRect or an ExtentsRect. All rect types implement Rectlike.

Variants

Sized(SizedRect<T, Unit>)

A SizedRect.

Extents(ExtentsRect<T, Unit>)

An ExtentsRect.

Implementations

Returns a new rect using origin and size.

Returns a new rect using points origin and extent.

Attempts to cast T to NewT. If unsuccessful, None is returned.

Casts T to NewT.

Panics

Panics if casting fails.

Returns this value with the new unit. Does not affect the underlying value.

Returns a new rectangle that rounds the origin down using floor and rounds the extent/size out using ceil.

Returns a new rectangle that rounds the origin up using ceil and rounds the extent/size in using floor.

Trait Implementations

Used for specifying relative comparisons.

The default tolerance to use when testing values that are close together. Read more

A test for equality that uses the absolute difference to compute the approximate equality of two numbers. Read more

The inverse of [AbsDiffEq::abs_diff_eq].

Returns true if the values are approximately equal. Uses [approx::AbsDiffEq] with the default epsilon. Read more

Returns true if the values are not approximately equal. Uses [approx::AbsDiffEq] with the default epsilon. Read more

Rounds to the smallest integer equal or greater than the original value. 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

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

The Pixels unit type for this implementor.

The Points unit type for this implementor.

The Scaled unit type for this implementor.

Returns this value after applying scale, if needed.

Returns this value after applying scale, if needed.

Returns this value after applying scale, if needed.

The Pixels unit type for this implementor.

The Points unit type for this implementor.

The Scaled unit type for this implementor.

Returns this value after applying scale, if needed.

Returns this value after applying scale, if needed.

Returns this value after applying scale, if needed.

The Pixels unit type for this implementor.

The Points unit type for this implementor.

The Scaled unit type for this implementor.

Returns this value after applying scale, if needed.

Returns this value after applying scale, if needed.

Returns this value after applying scale, if needed.

The resulting type after applying the / operator.

Performs the / operation. Read more

Rounds to the biggest integer equal or lower than the original value. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

The resulting type after applying the * operator.

Performs the * operation. Read more

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

This method tests for !=.

Returns this rectangle as a Rect. The rectangle’s underlying data will be unchanged by this operation. Read more

Returns this rectangle converted to an ExtentsRect.

Returns this rectangle converted to a SizedRect.

Returns the width of the rectangle.

Returns the height of the rectangle.

Returns the origin of the rectangle.

Moves this rectangle by the vector provided.

Increases the size of this rectangle by the vector provided. The rectangle will grow around its center.

Checks to see if this rect is empty. If it is, None is returned. If it isn’t, the rect is returned unmodified. Read more

Returns true if the rect doesn’t have a positive width and height.

Returns the area contained by this rectangle.

Returns the size of the rectangle.

Returns the center of the rectangle.

Returns true if point is within this rectangle.

Returns the intersecting area between the two rectangles. If the rectangles do not intersect, None is returned. Read more

Returns the union of the two rectangles. If both rectangles aren’t empty, the smallest rectangle that both rectangles can fit into will be returned. If either rectangle is empty, the other rectangle is returned unmodified. Read more

The default relative tolerance for testing values that are far-apart. Read more

A test for equality that uses a relative comparison if the values are far apart.

The inverse of [RelativeEq::relative_eq].

Rounds to the nearest integer value. Read more

Serialize this value into the given Serde serializer. Read more

The default ULPs to tolerate when testing values that are far-apart. Read more

A test for equality that uses units in the last place (ULP) if the values are far apart.

The inverse of [UlpsEq::ulps_eq].

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