#[repr(C)]pub struct GenericCalcPercentageLeaf<P> {
pub value: P,
pub hint: Optional<NumericBaseType>,
}Expand description
The value of a percentage leaf node that contains an associated percent hint.
Fields§
§value: PThe 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<P> GenericCalcPercentageLeaf<P>
impl<P> GenericCalcPercentageLeaf<P>
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<P: Clone> Clone for GenericCalcPercentageLeaf<P>
impl<P: Clone> Clone for GenericCalcPercentageLeaf<P>
Source§fn clone(&self) -> GenericCalcPercentageLeaf<P>
fn clone(&self) -> GenericCalcPercentageLeaf<P>
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<P: Debug> Debug for GenericCalcPercentageLeaf<P>
impl<P: Debug> Debug for GenericCalcPercentageLeaf<P>
Source§impl<'de, P> Deserialize<'de> for GenericCalcPercentageLeaf<P>where
P: Deserialize<'de>,
impl<'de, P> Deserialize<'de> for GenericCalcPercentageLeaf<P>where
P: Deserialize<'de>,
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<P> MallocSizeOf for GenericCalcPercentageLeaf<P>where
P: MallocSizeOf,
impl<P> MallocSizeOf for GenericCalcPercentageLeaf<P>where
P: MallocSizeOf,
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<P: PartialEq> PartialEq for GenericCalcPercentageLeaf<P>
impl<P: PartialEq> PartialEq for GenericCalcPercentageLeaf<P>
Source§fn eq(&self, other: &GenericCalcPercentageLeaf<P>) -> bool
fn eq(&self, other: &GenericCalcPercentageLeaf<P>) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl<P> Serialize for GenericCalcPercentageLeaf<P>where
P: Serialize,
impl<P> Serialize for GenericCalcPercentageLeaf<P>where
P: Serialize,
Source§impl<P> ToAnimatedZero for GenericCalcPercentageLeaf<P>where
P: ToAnimatedZero,
impl<P> ToAnimatedZero for GenericCalcPercentageLeaf<P>where
P: ToAnimatedZero,
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<P> ToCss for GenericCalcPercentageLeaf<P>where
P: ToCss,
impl<P> ToCss for GenericCalcPercentageLeaf<P>where
P: ToCss,
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<P> ToResolvedValue for GenericCalcPercentageLeaf<P>where
P: ToResolvedValue,
impl<P> ToResolvedValue for GenericCalcPercentageLeaf<P>where
P: ToResolvedValue,
Source§type ResolvedValue = GenericCalcPercentageLeaf<<P as ToResolvedValue>::ResolvedValue>
type ResolvedValue = GenericCalcPercentageLeaf<<P as ToResolvedValue>::ResolvedValue>
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<P> ToShmem for GenericCalcPercentageLeaf<P>where
P: ToShmem,
impl<P> ToShmem for GenericCalcPercentageLeaf<P>where
P: ToShmem,
Source§impl<P> ToTyped for GenericCalcPercentageLeaf<P>where
P: ToTyped,
impl<P> ToTyped for GenericCalcPercentageLeaf<P>where
P: 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<P: Copy> Copy for GenericCalcPercentageLeaf<P>
impl<P> StructuralPartialEq for GenericCalcPercentageLeaf<P>
Auto Trait Implementations§
impl<P> Freeze for GenericCalcPercentageLeaf<P>where
P: Freeze,
impl<P> RefUnwindSafe for GenericCalcPercentageLeaf<P>where
P: RefUnwindSafe,
impl<P> Send for GenericCalcPercentageLeaf<P>where
P: Send,
impl<P> Sync for GenericCalcPercentageLeaf<P>where
P: Sync,
impl<P> Unpin for GenericCalcPercentageLeaf<P>where
P: Unpin,
impl<P> UnsafeUnpin for GenericCalcPercentageLeaf<P>where
P: UnsafeUnpin,
impl<P> UnwindSafe for GenericCalcPercentageLeaf<P>where
P: UnwindSafe,
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