FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    RelativeScalar

    struct · ferroui-base · v0.5.0

    struct RelativeScalar
    

    Defines a scalar that may be defined relative to a containing element.

    Equality treats NaN scalars as equal to each other.

    View source

    Members

    scalar

    scalar: f64
    

    The scalar.

    Source

    unit

    unit: crate::RelativeUnit
    

    The unit of the scalar.

    Source

    BEGINNING

    const BEGINNING: RelativeScalar
    

    The beginning of the containing element (0%).

    Source

    MIDDLE

    const MIDDLE: RelativeScalar
    

    The middle of the containing element (50%).

    Source

    END

    const END: RelativeScalar
    

    The end of the containing element (100%).

    Source

    new

    const fn new(scalar: f64, unit: RelativeUnit) -> Self
    

    Source

    equals

    fn equals(self: &Self, other: RelativeScalar) -> bool
    

    Source

    to_value

    fn to_value(self: &Self, size: f64) -> f64
    

    Converts the scalar into a final value, using size as the size the scalar is relative to.

    Source

    parse

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

    Parses a RelativeScalar string: "n" (absolute) or "n%" (relative).

    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
    • IInterpolator<RelativeScalar>
    • From<RelativeScalar>
    • ExpressionVariantValue
    • ServerPropertyValue
    • BatchValue
    • MarkupTyped
    • ValueTypeRegistration
    • Clone
    • Copy
    • Debug
    • Default
    • PartialEq
    • FromStr
    • Display

    Availability

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