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.
Members
scalar
scalar: f64
The scalar.
unit
unit: crate::RelativeUnit
The unit of the scalar.
BEGINNING
const BEGINNING: RelativeScalar
The beginning of the containing element (0%).
MIDDLE
const MIDDLE: RelativeScalar
The middle of the containing element (50%).
END
const END: RelativeScalar
The end of the containing element (100%).
new
const fn new(scalar: f64, unit: RelativeUnit) -> Self
equals
fn equals(self: &Self, other: RelativeScalar) -> bool
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.
parse
fn parse(s: &str) -> Result<Self, FormatError>
Parses a RelativeScalar string: "n" (absolute) or "n%" (relative).
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafePropertyValueAnyValueClassDefaultsBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedToStringErasedDestructorIntoEitherIInterpolator<RelativeScalar>From<RelativeScalar>ExpressionVariantValueServerPropertyValueBatchValueMarkupTypedValueTypeRegistrationCloneCopyDebugDefaultPartialEqFromStrDisplay
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.