FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    Size

    struct · ferroui-base · v0.5.0

    struct Size
    

    Defines a size.

    View source

    Members

    width

    width: f64
    

    The width.

    Source

    height

    height: f64
    

    The height.

    Source

    INFINITY

    const INFINITY: Size
    

    A size representing infinity.

    Source

    new

    const fn new(width: f64, height: f64) -> Self
    

    Initializes a new instance of the Size structure.

    Source

    aspect_ratio

    fn aspect_ratio(self: &Self) -> f64
    

    Gets the aspect ratio of the size.

    Source

    parse

    fn parse(s: &str) -> Result<Self, FormatError>
    

    Parses a Size string ("width, height" or "width height").

    Source

    constrain

    fn constrain(self: &Self, constraint: Size) -> Size
    

    Constrains the size: each dimension becomes the smaller of this size's and the constraint's.

    Source

    deflate

    fn deflate(self: &Self, thickness: Thickness) -> Size
    

    Deflates the size by a Thickness. The result never has negative dimensions.

    Source

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

    Source

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

    Source

    inflate

    fn inflate(self: &Self, thickness: Thickness) -> Size
    

    Inflates the size by a Thickness.

    Source

    with_width

    const fn with_width(self: &Self, width: f64) -> Size
    

    Returns a new Size with the same height and the specified width.

    Source

    with_height

    const fn with_height(self: &Self, height: f64) -> Size
    

    Returns a new Size with the same width and the specified height.

    Source

    deconstruct

    const fn deconstruct(self: &Self) -> (f64, f64)
    

    Deconstructs the size into its width and height values.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • PropertyValue
    • AnyValue
    • ClassDefaults
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • ToString
    • ErasedDestructor
    • IntoEither
    • Transition<Size>
    • From<Size>
    • ServerPropertyValue
    • BatchValue
    • MarkupTyped
    • ValueTypeRegistration
    • Clone
    • Copy
    • Debug
    • StructuralPartialEq
    • PartialEq
    • Default
    • Mul<Vector>
    • Div<Vector>
    • Div
    • Mul<f64>
    • Div<f64>
    • Add
    • Sub
    • AddAssign
    • SubAssign
    • MulAssign<f64>
    • DivAssign<f64>
    • MulAssign<Vector>
    • DivAssign<Vector>
    • FromStr
    • Display
    • Add<Thickness>
    • Sub<Thickness>
    • AddAssign<Thickness>
    • SubAssign<Thickness>

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.