pub enum CalcExpression<U: Unit> {
CalculablePropertyValue(CalculablePropertyValue<U>),
Number(U::Number),
Parentheses(Box<CalcExpression<U>>),
Addition(Box<CalcExpression<U>>, Box<CalcExpression<U>>),
Subtraction(Box<CalcExpression<U>>, Box<CalcExpression<U>>),
Multiplication(Box<CalcExpression<U>>, Box<CalcExpression<U>>),
Division(Box<CalcExpression<U>>, Box<CalcExpression<U>>),
}
Variants§
CalculablePropertyValue(CalculablePropertyValue<U>)
Number(U::Number)
Parentheses(Box<CalcExpression<U>>)
Addition(Box<CalcExpression<U>>, Box<CalcExpression<U>>)
Subtraction(Box<CalcExpression<U>>, Box<CalcExpression<U>>)
Multiplication(Box<CalcExpression<U>>, Box<CalcExpression<U>>)
Division(Box<CalcExpression<U>>, Box<CalcExpression<U>>)
Trait Implementations§
Source§impl<U: Clone + Unit> Clone for CalcExpression<U>
impl<U: Clone + Unit> Clone for CalcExpression<U>
Source§fn clone(&self) -> CalcExpression<U>
fn clone(&self) -> CalcExpression<U>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<U: Unit> Default for CalcExpression<U>
impl<U: Unit> Default for CalcExpression<U>
Source§impl<U: Unit> Expression<U> for CalcExpression<U>
impl<U: Unit> Expression<U> for CalcExpression<U>
Source§fn evaluate<Conversion: FontRelativeLengthConversion<U::Number> + ViewportPercentageLengthConversion<U::Number> + PercentageConversion<U::Number> + AttributeConversion<U> + CssVariableConversion>(
&self,
conversion: &Conversion,
) -> Option<U::Number>
fn evaluate<Conversion: FontRelativeLengthConversion<U::Number> + ViewportPercentageLengthConversion<U::Number> + PercentageConversion<U::Number> + AttributeConversion<U> + CssVariableConversion>( &self, conversion: &Conversion, ) -> Option<U::Number>
Evaluate the calc() expression, returning the numeric value of the canonical dimension Division by zero is handled by returning the maximum possible f32 value Subtractions for UnsignedCssNumber that are negative are handled by returning 0.0 Note: We are quite lenient with calculations of unit-less and unit-having quantities, eg 100px * 100px is evaluated to 10,000px, not 10,000px^2, and 50 + 100px is evaluated to 150px
Source§impl<U: Ord + Unit> Ord for CalcExpression<U>
impl<U: Ord + Unit> Ord for CalcExpression<U>
Source§fn cmp(&self, other: &CalcExpression<U>) -> Ordering
fn cmp(&self, other: &CalcExpression<U>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<U: PartialOrd + Unit> PartialOrd for CalcExpression<U>where
U::Number: PartialOrd,
impl<U: PartialOrd + Unit> PartialOrd for CalcExpression<U>where
U::Number: PartialOrd,
Source§impl<U: Unit> ToCss for CalcExpression<U>
impl<U: Unit> ToCss for CalcExpression<U>
impl<U: Eq + Unit> Eq for CalcExpression<U>
impl<U: Unit> StructuralPartialEq for CalcExpression<U>
Auto Trait Implementations§
impl<U> Freeze for CalcExpression<U>
impl<U> RefUnwindSafe for CalcExpression<U>
impl<U> !Send for CalcExpression<U>
impl<U> !Sync for CalcExpression<U>
impl<U> Unpin for CalcExpression<U>
impl<U> UnwindSafe for CalcExpression<U>
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