Size
struct · ferroui-base · v0.5.0
struct Size
Defines a size.
Members
widthheightINFINITYnewaspect_ratioparseconstraindeflateequalsnearly_equalsinflatewith_widthwith_heightdeconstruct
width
width: f64
The width.
height
height: f64
The height.
INFINITY
const INFINITY: Size
A size representing infinity.
new
const fn new(width: f64, height: f64) -> Self
Initializes a new instance of the Size structure.
aspect_ratio
fn aspect_ratio(self: &Self) -> f64
Gets the aspect ratio of the size.
parse
fn parse(s: &str) -> Result<Self, FormatError>
Parses a Size string ("width, height" or "width height").
constrain
fn constrain(self: &Self, constraint: Size) -> Size
Constrains the size: each dimension becomes the smaller of this size's and the constraint's.
deflate
fn deflate(self: &Self, thickness: Thickness) -> Size
Deflates the size by a Thickness. The result never has negative dimensions.
equals
fn equals(self: &Self, other: Size) -> bool
Returns a boolean indicating whether the size is equal to the other given size (exact comparison of the dimensions).
nearly_equals
fn nearly_equals(self: &Self, other: Size) -> bool
Returns a boolean indicating whether the size is equal to the other given size (numerically, within a relative epsilon).
inflate
fn inflate(self: &Self, thickness: Thickness) -> Size
Inflates the size by a Thickness.
with_width
const fn with_width(self: &Self, width: f64) -> Size
Returns a new Size with the same height and the specified width.
with_height
const fn with_height(self: &Self, height: f64) -> Size
Returns a new Size with the same width and the specified height.
deconstruct
const fn deconstruct(self: &Self) -> (f64, f64)
Deconstructs the size into its width and height values.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafePropertyValueAnyValueClassDefaultsBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedToStringErasedDestructorIntoEitherTransition<Size>From<Size>ServerPropertyValueBatchValueMarkupTypedValueTypeRegistrationCloneCopyDebugStructuralPartialEqPartialEqDefaultMul<Vector>Div<Vector>DivMul<f64>Div<f64>AddSubAddAssignSubAssignMulAssign<f64>DivAssign<f64>MulAssign<Vector>DivAssign<Vector>FromStrDisplayAdd<Thickness>Sub<Thickness>AddAssign<Thickness>SubAssign<Thickness>
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.