#[non_exhaustive]pub enum LengthExpr {
Add(Length, Length),
Sub(Length, Length),
Mul(Length, Factor),
Div(Length, Factor),
Max(Length, Length),
Min(Length, Length),
Abs(Length),
Neg(Length),
Lerp(Length, Length, Factor),
}Expand description
Represents an unresolved Length expression.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Add(Length, Length)
Sums the both layout length.
Sub(Length, Length)
Subtracts the first layout length from the second.
Mul(Length, Factor)
Multiplies the layout length by the factor.
Div(Length, Factor)
Divide the layout length by the factor.
Max(Length, Length)
Maximum layout length.
Min(Length, Length)
Minimum layout length.
Abs(Length)
Computes the absolute layout length.
Neg(Length)
Negate the layout length.
Lerp(Length, Length, Factor)
Linear interpolate between lengths by factor.
Implementations§
Source§impl LengthExpr
impl LengthExpr
Sourcepub fn memory_used(&self) -> ByteLength
pub fn memory_used(&self) -> ByteLength
Gets the total memory allocated by this length expression.
This includes the sum of all nested Length::Expr heap memory.
Sourcepub fn to_length_checked(self) -> Length
pub fn to_length_checked(self) -> Length
Convert to Length::Expr, logs warning for memory use above 1kB, logs error for use > 20kB and collapses to Length::zero.
Every length expression created using the std::ops uses this method to check the constructed expression. Some operations
like iterator fold can cause an expression explosion where two lengths of different units that cannot
be evaluated immediately start an expression that subsequently is wrapped in a new expression for each operation done on it.
Sourcepub fn has_default(&self) -> bool
pub fn has_default(&self) -> bool
If contains a Length::Default value.
Sourcepub fn replace_default(&mut self, overwrite: &Length)
pub fn replace_default(&mut self, overwrite: &Length)
Replace all Length::Default values with overwrite.
Trait Implementations§
Source§impl Clone for LengthExpr
impl Clone for LengthExpr
Source§fn clone(&self) -> LengthExpr
fn clone(&self) -> LengthExpr
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LengthExpr
impl Debug for LengthExpr
Source§impl<'de> Deserialize<'de> for LengthExpr
impl<'de> Deserialize<'de> for LengthExpr
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<LengthExpr, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<LengthExpr, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Display for LengthExpr
impl Display for LengthExpr
Source§impl From<LengthExpr> for Length
impl From<LengthExpr> for Length
Source§fn from(expr: LengthExpr) -> Length
fn from(expr: LengthExpr) -> Length
Source§impl FromStr for LengthExpr
impl FromStr for LengthExpr
Source§type Err = ParseCompositeError
type Err = ParseCompositeError
Source§fn from_str(s: &str) -> Result<LengthExpr, <LengthExpr as FromStr>::Err>
fn from_str(s: &str) -> Result<LengthExpr, <LengthExpr as FromStr>::Err>
s to return a value of this type. Read moreSource§impl Hash for LengthExpr
impl Hash for LengthExpr
Source§impl IntoVar<Indentation> for LengthExpr
impl IntoVar<Indentation> for LengthExpr
fn into_var(self) -> Var<Indentation>
Source§impl Layout1d for LengthExpr
impl Layout1d for LengthExpr
Source§fn layout_dft(&self, axis: LayoutAxis, default: Px) -> Px
fn layout_dft(&self, axis: LayoutAxis, default: Px) -> Px
LAYOUT context with default.Source§fn layout_f32_dft(&self, axis: LayoutAxis, default: f32) -> f32
fn layout_f32_dft(&self, axis: LayoutAxis, default: f32) -> f32
LAYOUT context with default.Source§fn affect_mask(&self) -> LayoutMask
fn affect_mask(&self) -> LayoutMask
LayoutMask that flags all contextual values that affect the result of layout.Source§fn layout(&self, axis: LayoutAxis) -> Px
fn layout(&self, axis: LayoutAxis) -> Px
LAYOUT context.Source§fn layout_dft_x(&self, default: Px) -> Px
fn layout_dft_x(&self, default: Px) -> Px
LAYOUT context x axis with default.Source§fn layout_dft_y(&self, default: Px) -> Px
fn layout_dft_y(&self, default: Px) -> Px
LAYOUT context y axis with default.Source§fn layout_dft_z(&self, default: Px) -> Px
fn layout_dft_z(&self, default: Px) -> Px
LAYOUT context z axis with default.Source§fn layout_f32(&self, axis: LayoutAxis) -> f32
fn layout_f32(&self, axis: LayoutAxis) -> f32
LAYOUT context.Source§fn layout_f32_x(&self) -> f32
fn layout_f32_x(&self) -> f32
LAYOUT context x axis.Source§fn layout_f32_y(&self) -> f32
fn layout_f32_y(&self) -> f32
LAYOUT context y axis.Source§fn layout_f32_z(&self) -> f32
fn layout_f32_z(&self) -> f32
LAYOUT context z axis.Source§fn layout_f32_dft_x(&self, default: f32) -> f32
fn layout_f32_dft_x(&self, default: f32) -> f32
LAYOUT context x axis with default.Source§impl PartialEq for LengthExpr
impl PartialEq for LengthExpr
Source§impl Serialize for LengthExpr
impl Serialize for LengthExpr
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for LengthExpr
impl IntoValue<Indentation> for LengthExpr
impl IntoValue<Length> for LengthExpr
impl StructuralPartialEq for LengthExpr
Auto Trait Implementations§
impl Freeze for LengthExpr
impl RefUnwindSafe for LengthExpr
impl Send for LengthExpr
impl Sync for LengthExpr
impl Unpin for LengthExpr
impl UnwindSafe for LengthExpr
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
Source§impl<T> AnyVarValue for T
impl<T> AnyVarValue for T
Source§fn clone_boxed(&self) -> BoxAnyVarValue
fn clone_boxed(&self) -> BoxAnyVarValue
Source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
self and other are equal.Source§fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
other if both are of the same type.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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DataNoteValue for T
impl<T> DataNoteValue for T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Source§impl<T> FsChangeNote for T
impl<T> FsChangeNote for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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 more§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Separable for Twhere
T: Display,
impl<T> Separable for Twhere
T: Display,
Source§fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
SeparatorPolicy. Read more