pub struct RelativeScalar {
pub scalar: f64,
pub unit: RelativeUnit,
}Expand description
Defines a scalar that may be defined relative to a containing element.
Equality treats NaN scalars as equal to each other.
Fields§
§scalar: f64The scalar.
unit: RelativeUnitThe unit of the scalar.
Implementations§
Source§impl RelativeScalar
impl RelativeScalar
Sourcepub const BEGINNING: RelativeScalar
pub const BEGINNING: RelativeScalar
The beginning of the containing element (0%).
Sourcepub const MIDDLE: RelativeScalar
pub const MIDDLE: RelativeScalar
The middle of the containing element (50%).
Sourcepub const END: RelativeScalar
pub const END: RelativeScalar
The end of the containing element (100%).
pub const fn new(scalar: f64, unit: RelativeUnit) -> Self
pub fn equals(&self, other: RelativeScalar) -> bool
Sourcepub fn to_value(&self, size: f64) -> f64
pub fn to_value(&self, size: f64) -> f64
Converts the scalar into a final value, using size as the size the scalar
is relative to.
Sourcepub fn parse(s: &str) -> Result<Self, FormatError>
pub fn parse(s: &str) -> Result<Self, FormatError>
Parses a RelativeScalar string: "n" (absolute) or "n%" (relative).
Trait Implementations§
Source§impl BatchValue for RelativeScalar
impl BatchValue for RelativeScalar
Source§impl Clone for RelativeScalar
impl Clone for RelativeScalar
impl Copy for RelativeScalar
Source§impl Debug for RelativeScalar
impl Debug for RelativeScalar
Source§impl Default for RelativeScalar
impl Default for RelativeScalar
Source§impl Display for RelativeScalar
impl Display for RelativeScalar
Source§impl ExpressionVariantValue for RelativeScalar
impl ExpressionVariantValue for RelativeScalar
Source§const FFI_VARIANT_TYPE: Option<VariantType>
const FFI_VARIANT_TYPE: Option<VariantType>
The variant type a foreign function parameter of this type is matched
against, or
None when the type cannot be a foreign function parameter.Source§fn try_from_variant(v: &ExpressionVariant) -> Option<Self>
fn try_from_variant(v: &ExpressionVariant) -> Option<Self>
Source§fn into_variant(self) -> ExpressionVariant
fn into_variant(self) -> ExpressionVariant
Source§impl From<RelativeScalar> for ExpressionVariant
impl From<RelativeScalar> for ExpressionVariant
Source§fn from(value: RelativeScalar) -> ExpressionVariant
fn from(value: RelativeScalar) -> ExpressionVariant
Converts to this type from the input type.
Source§impl FromStr for RelativeScalar
impl FromStr for RelativeScalar
Source§impl IInterpolator<RelativeScalar> for RelativeScalarInterpolator
impl IInterpolator<RelativeScalar> for RelativeScalarInterpolator
fn interpolate( &self, from: RelativeScalar, to: RelativeScalar, progress: f32, ) -> RelativeScalar
Source§impl MarkupTyped for RelativeScalar
impl MarkupTyped for RelativeScalar
Source§const MARKUP: &'static MarkupType
const MARKUP: &'static MarkupType
The markup metadata of the type.
Source§impl PartialEq for RelativeScalar
impl PartialEq for RelativeScalar
Source§impl ServerPropertyValue for RelativeScalar
impl ServerPropertyValue for RelativeScalar
Auto Trait Implementations§
impl Freeze for RelativeScalar
impl RefUnwindSafe for RelativeScalar
impl Send for RelativeScalar
impl Sync for RelativeScalar
impl Unpin for RelativeScalar
impl UnsafeUnpin for RelativeScalar
impl UnwindSafe for RelativeScalar
Blanket Implementations§
Source§impl<T> AnyValue for Twhere
T: PartialEq + 'static,
impl<T> AnyValue for Twhere
T: PartialEq + 'static,
fn any_value_as_any(&self) -> &(dyn Any + 'static)
fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool
fn any_value_type_name(&self) -> &'static str
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
The static constructor of a type: work done once per thread, after
the properties of the type are registered and before its first
instance exists (class handlers,
affects_render, metadata
overrides). Read more