pub struct Size<T, Unit> {
    pub width: T,
    pub height: T,
    /* private fields */
}
Expand description

A measurement of space using width and height.

Fields

width: Theight: T

Implementations

Returns the area represented by this size.

Returns a new vector with width, and T::default() for height.

Returns a new vector with height, and T::default() for width.

Returns a new Size.

Returns a new Size.

Returns the width component.

Returns the height component.

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

Attempts to convert from T to Output using NumCast. Returns None if the value can’t be converted.

Converts from T to Output.

Panics

Panics if Self::try_cast() returns None.

Returns a new instance with the absolute value of each component.

Returns a Vector with the result of signum() called on each component.

Returns a new Size with the smaller value of each component.

Returns a new Size with the larger value of each component.

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.

The resulting type after applying the + operator.

Performs the + operation. Read more

The resulting type after applying the + operator.

Performs the + operation. Read more

The resulting type after applying the + operator.

Performs the + operation. Read more

The resulting type after applying the + operator.

Performs the + operation. Read more

Performs the += operation. Read more

Performs the += operation. Read more

Performs the += operation. Read more

Performs the += operation. Read more

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

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

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

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the - operator.

Performs the unary - operation. Read more

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

This method tests for !=.

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

This method tests for !=.

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

This method tests for !=.

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

This method tests for !=.

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

The resulting type after applying the - operator.

Performs the - operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

Performs the -= operation. Read more

Performs the -= operation. Read more

Performs the -= operation. Read more

Performs the -= operation. 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.

Returns self as a Vector.

Returns self as a Size.

Returns self as a Point.

Auto Trait Implementations

Blanket Implementations

Convert the source color to the destination color using the specified method Read more

Convert the source color to the destination color using the bradford method by default Read more

Gets the TypeId of self. Read more

Returns the underlying type as Any.

Returns the underlying type as Any.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

Convert into T with values clamped to the color defined bounds Read more

Convert into T. The resulting color might be invalid in its color space 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)

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.

Convert into T, returning ok if the color is inside of its defined range, otherwise an OutOfBounds error is returned which contains the unclamped color. Read more

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more