#[repr(C)]pub struct CalcPercentageLeaf {
pub value: NoCalcPercentage,
pub hint: Optional<NumericBaseType>,
}Expand description
The value of a percentage leaf node that contains an associated percent hint.
Fields§
§value: NoCalcPercentageThe percentage value.
hint: Optional<NumericBaseType>The base type the percentage resolves against, or None if there is no specific percent hint (this is used by CSS Typed OM when parsing an expression without the context of a property).
Implementations§
Source§impl CalcPercentageLeaf
impl CalcPercentageLeaf
Sourcepub fn new(value: f32, hint: Optional<NumericBaseType>) -> Self
pub fn new(value: f32, hint: Optional<NumericBaseType>) -> Self
Builds a percentage leaf with the given percent hint.
Sourcepub fn numeric_type(&self) -> NumericType
pub fn numeric_type(&self) -> NumericType
Returns the numeric type of this percentage.
Sourcepub fn combined_hint(&self, other: &Self) -> Optional<NumericBaseType>
pub fn combined_hint(&self, other: &Self) -> Optional<NumericBaseType>
Returns the percent hint to use when merging two percentages with an arithmetic operation. Mismatched hints should be impossible after type checking.
Trait Implementations§
Source§impl Clone for CalcPercentageLeaf
impl Clone for CalcPercentageLeaf
Source§fn clone(&self) -> CalcPercentageLeaf
fn clone(&self) -> CalcPercentageLeaf
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CalcPercentageLeaf
impl Debug for CalcPercentageLeaf
Source§impl<'de> Deserialize<'de> for CalcPercentageLeaf
impl<'de> Deserialize<'de> for CalcPercentageLeaf
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl MallocSizeOf for CalcPercentageLeaf
impl MallocSizeOf for CalcPercentageLeaf
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
Source§impl PartialEq for CalcPercentageLeaf
impl PartialEq for CalcPercentageLeaf
Source§fn eq(&self, other: &CalcPercentageLeaf) -> bool
fn eq(&self, other: &CalcPercentageLeaf) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for CalcPercentageLeaf
impl Serialize for CalcPercentageLeaf
Source§impl ToAnimatedZero for CalcPercentageLeaf
impl ToAnimatedZero for CalcPercentageLeaf
Source§fn to_animated_zero(&self) -> Result<Self, ()>
fn to_animated_zero(&self) -> Result<Self, ()>
Returns a value that, when added with an underlying value, will produce the underlying
value. This is used for SMIL animation’s “by-animation” where SMIL first interpolates from
the zero value to the ‘by’ value, and then adds the result to the underlying value. Read more
Source§impl ToCss for CalcPercentageLeaf
impl ToCss for CalcPercentageLeaf
Source§fn to_css<W>(&self, dest: &mut CssWriter<'_, W>) -> Resultwhere
W: Write,
fn to_css<W>(&self, dest: &mut CssWriter<'_, W>) -> Resultwhere
W: Write,
Serialize
self in CSS syntax, writing to dest.Source§fn to_css_string(&self) -> String
fn to_css_string(&self) -> String
Serialize
self in CSS syntax and return a string. Read moreSource§fn to_css_cssstring(&self) -> String
fn to_css_cssstring(&self) -> String
Serialize
self in CSS syntax and return a CssString. Read moreSource§impl ToResolvedValue for CalcPercentageLeafwhere
NoCalcPercentage: ToResolvedValue<ResolvedValue = NoCalcPercentage>,
Optional<NumericBaseType>: ToResolvedValue<ResolvedValue = Optional<NumericBaseType>>,
impl ToResolvedValue for CalcPercentageLeafwhere
NoCalcPercentage: ToResolvedValue<ResolvedValue = NoCalcPercentage>,
Optional<NumericBaseType>: ToResolvedValue<ResolvedValue = Optional<NumericBaseType>>,
Source§type ResolvedValue = CalcPercentageLeaf
type ResolvedValue = CalcPercentageLeaf
The resolved value type we’re going to be converted to.
Source§fn from_resolved_value(from: Self::ResolvedValue) -> Self
fn from_resolved_value(from: Self::ResolvedValue) -> Self
Convert a resolved value to resolved value form.
Source§fn to_resolved_value(self, context: &Context<'_>) -> Self::ResolvedValue
fn to_resolved_value(self, context: &Context<'_>) -> Self::ResolvedValue
Convert a resolved value to a resolved value.
Source§impl ToShmem for CalcPercentageLeaf
impl ToShmem for CalcPercentageLeaf
Source§impl ToTyped for CalcPercentageLeafwhere
NoCalcPercentage: ToTyped,
impl ToTyped for CalcPercentageLeafwhere
NoCalcPercentage: ToTyped,
Source§fn to_typed_value(&self) -> Option<TypedValue>
fn to_typed_value(&self) -> Option<TypedValue>
Source§fn to_numeric_value(&self) -> Option<NumericValue>
fn to_numeric_value(&self) -> Option<NumericValue>
Source§fn to_typed_value_list(&self) -> Option<TypedValueList>
fn to_typed_value_list(&self) -> Option<TypedValueList>
impl Copy for CalcPercentageLeaf
impl StructuralPartialEq for CalcPercentageLeaf
Auto Trait Implementations§
impl Freeze for CalcPercentageLeaf
impl RefUnwindSafe for CalcPercentageLeaf
impl Send for CalcPercentageLeaf
impl Sync for CalcPercentageLeaf
impl Unpin for CalcPercentageLeaf
impl UnsafeUnpin for CalcPercentageLeaf
impl UnwindSafe for CalcPercentageLeaf
Blanket Implementations§
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert