#[repr(transparent)]pub struct Factor(pub f32);
Expand description
Normalized multiplication factor.
Values of this type are normalized to generally be in between 0.0
and 1.0
to indicate a fraction
of a unit. However, values are not clamped to this range, Factor(2.0)
is a valid value and so are
negative values.
§Equality
Equality is determined to within 0.00001
epsilon.
Tuple Fields§
§0: f32
Implementations§
source§impl Factor
impl Factor
sourcepub fn clamp_range(self) -> Factor
pub fn clamp_range(self) -> Factor
Clamp factor to [0.0..=1.0]
range.
sourcepub fn clamp(self, min: impl Into<Factor>, max: impl Into<Factor>) -> Factor
pub fn clamp(self, min: impl Into<Factor>, max: impl Into<Factor>) -> Factor
Returns self
if min <= self <= max
, returns min
if self < min
or returns max
if self > max
.
sourcepub fn pct(self) -> FactorPercent
pub fn pct(self) -> FactorPercent
Factor as percentage.
Trait Implementations§
source§impl AddAssign for Factor
impl AddAssign for Factor
source§fn add_assign(&mut self, rhs: Factor)
fn add_assign(&mut self, rhs: Factor)
+=
operation. Read moresource§impl<'de> Deserialize<'de> for Factor
impl<'de> Deserialize<'de> for Factor
source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Factor, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Factor, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl Div<Factor> for FactorPercent
impl Div<Factor> for FactorPercent
source§type Output = FactorPercent
type Output = FactorPercent
/
operator.source§impl Div<Factor> for LayerIndex
impl Div<Factor> for LayerIndex
source§impl DivAssign<Factor> for Dip
impl DivAssign<Factor> for Dip
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
/=
operation. Read moresource§impl DivAssign<Factor> for Factor2d
impl DivAssign<Factor> for Factor2d
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
/=
operation. Read moresource§impl DivAssign<Factor> for FactorPercent
impl DivAssign<Factor> for FactorPercent
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
/=
operation. Read moresource§impl DivAssign<Factor> for LayerIndex
impl DivAssign<Factor> for LayerIndex
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
/=
operation. Read moresource§impl DivAssign<Factor> for Point2D<Dip, Dip>
impl DivAssign<Factor> for Point2D<Dip, Dip>
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
/=
operation. Read moresource§impl DivAssign<Factor> for Point2D<Px, Px>
impl DivAssign<Factor> for Point2D<Px, Px>
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
/=
operation. Read moresource§impl DivAssign<Factor> for Point2D<f32, Px>
impl DivAssign<Factor> for Point2D<f32, Px>
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
/=
operation. Read moresource§impl DivAssign<Factor> for Px
impl DivAssign<Factor> for Px
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
/=
operation. Read moresource§impl DivAssign<Factor> for Rect<Dip, Dip>
impl DivAssign<Factor> for Rect<Dip, Dip>
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
/=
operation. Read moresource§impl DivAssign<Factor> for Rect<Px, Px>
impl DivAssign<Factor> for Rect<Px, Px>
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
/=
operation. Read moresource§impl DivAssign<Factor> for Size2D<Dip, Dip>
impl DivAssign<Factor> for Size2D<Dip, Dip>
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
/=
operation. Read moresource§impl DivAssign<Factor> for Size2D<Px, Px>
impl DivAssign<Factor> for Size2D<Px, Px>
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
/=
operation. Read moresource§impl DivAssign<Factor> for Size2D<f32, Px>
impl DivAssign<Factor> for Size2D<f32, Px>
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
/=
operation. Read moresource§impl DivAssign<Factor> for Vector2D<Dip, Dip>
impl DivAssign<Factor> for Vector2D<Dip, Dip>
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
/=
operation. Read moresource§impl DivAssign<Factor> for Vector2D<Px, Px>
impl DivAssign<Factor> for Vector2D<Px, Px>
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
/=
operation. Read moresource§impl DivAssign<Factor> for ZIndex
impl DivAssign<Factor> for ZIndex
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
/=
operation. Read moresource§impl DivAssign<Factor> for usize
impl DivAssign<Factor> for usize
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
/=
operation. Read moresource§impl DivAssign for Factor
impl DivAssign for Factor
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
/=
operation. Read moresource§impl From<Factor> for CornerRadius
impl From<Factor> for CornerRadius
source§fn from(norm: Factor) -> CornerRadius
fn from(norm: Factor) -> CornerRadius
All corners same relative length.
source§impl From<Factor> for EasingTime
impl From<Factor> for EasingTime
source§fn from(factor: Factor) -> EasingTime
fn from(factor: Factor) -> EasingTime
source§impl From<Factor> for FactorPercent
impl From<Factor> for FactorPercent
source§fn from(value: Factor) -> FactorPercent
fn from(value: Factor) -> FactorPercent
source§impl From<Factor> for FactorSideOffsets
impl From<Factor> for FactorSideOffsets
source§fn from(all: Factor) -> FactorSideOffsets
fn from(all: Factor) -> FactorSideOffsets
All sides equal.
source§impl From<Factor> for FontStretch
impl From<Factor> for FontStretch
source§fn from(fct: Factor) -> FontStretch
fn from(fct: Factor) -> FontStretch
source§impl From<Factor> for GradientRadius
impl From<Factor> for GradientRadius
source§fn from(norm: Factor) -> GradientRadius
fn from(norm: Factor) -> GradientRadius
Conversion to Length::Factor
and to radius.
source§impl From<Factor> for GradientStop
impl From<Factor> for GradientStop
source§fn from(color_hint: Factor) -> GradientStop
fn from(color_hint: Factor) -> GradientStop
Conversion to Length::Factor
color hint.
source§impl From<Factor> for GridSpacing
impl From<Factor> for GridSpacing
source§fn from(norm: Factor) -> GridSpacing
fn from(norm: Factor) -> GridSpacing
Column and row equal relative length.
source§impl From<Factor> for SideOffsets
impl From<Factor> for SideOffsets
source§fn from(norm: Factor) -> SideOffsets
fn from(norm: Factor) -> SideOffsets
All sides equal relative length.
source§impl From<FactorPercent> for Factor
impl From<FactorPercent> for Factor
source§fn from(value: FactorPercent) -> Factor
fn from(value: FactorPercent) -> Factor
source§impl IntoVar<CornerRadius> for Factor
impl IntoVar<CornerRadius> for Factor
source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
BoxedVar<T>
. Read moresource§impl IntoVar<EasingTime> for Factor
impl IntoVar<EasingTime> for Factor
source§fn into_var(self) -> <Factor as IntoVar<EasingTime>>::Var
fn into_var(self) -> <Factor as IntoVar<EasingTime>>::Var
source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
BoxedVar<T>
. Read moresource§impl IntoVar<Factor> for FactorPercent
impl IntoVar<Factor> for FactorPercent
source§impl IntoVar<FactorPercent> for Factor
impl IntoVar<FactorPercent> for Factor
source§fn into_var(self) -> <Factor as IntoVar<FactorPercent>>::Var
fn into_var(self) -> <Factor as IntoVar<FactorPercent>>::Var
source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
BoxedVar<T>
. Read moresource§impl IntoVar<FactorSideOffsets> for Factor
impl IntoVar<FactorSideOffsets> for Factor
source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
BoxedVar<T>
. Read moresource§impl IntoVar<FontStretch> for Factor
impl IntoVar<FontStretch> for Factor
source§fn into_var(self) -> <Factor as IntoVar<FontStretch>>::Var
fn into_var(self) -> <Factor as IntoVar<FontStretch>>::Var
source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
BoxedVar<T>
. Read moresource§impl IntoVar<GradientRadius> for Factor
impl IntoVar<GradientRadius> for Factor
source§fn into_var(self) -> <Factor as IntoVar<GradientRadius>>::Var
fn into_var(self) -> <Factor as IntoVar<GradientRadius>>::Var
Conversion to Length::Factor
and to radius.
source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
BoxedVar<T>
. Read moresource§impl IntoVar<GradientStop> for Factor
impl IntoVar<GradientStop> for Factor
source§fn into_var(self) -> <Factor as IntoVar<GradientStop>>::Var
fn into_var(self) -> <Factor as IntoVar<GradientStop>>::Var
Conversion to Length::Factor
color hint.
source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
BoxedVar<T>
. Read moresource§impl IntoVar<GridSpacing> for Factor
impl IntoVar<GridSpacing> for Factor
source§fn into_var(self) -> <Factor as IntoVar<GridSpacing>>::Var
fn into_var(self) -> <Factor as IntoVar<GridSpacing>>::Var
Column and row equal relative length.
source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
BoxedVar<T>
. Read moresource§impl IntoVar<SideOffsets> for Factor
impl IntoVar<SideOffsets> for Factor
source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
BoxedVar<T>
. Read moresource§impl Mul<Factor> for FactorPercent
impl Mul<Factor> for FactorPercent
source§type Output = FactorPercent
type Output = FactorPercent
*
operator.source§impl Mul<Factor> for LayerIndex
impl Mul<Factor> for LayerIndex
source§impl MulAssign<Factor> for Dip
impl MulAssign<Factor> for Dip
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
*=
operation. Read moresource§impl MulAssign<Factor> for Factor2d
impl MulAssign<Factor> for Factor2d
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
*=
operation. Read moresource§impl MulAssign<Factor> for FactorPercent
impl MulAssign<Factor> for FactorPercent
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
*=
operation. Read moresource§impl MulAssign<Factor> for LayerIndex
impl MulAssign<Factor> for LayerIndex
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
*=
operation. Read moresource§impl MulAssign<Factor> for Point2D<Dip, Dip>
impl MulAssign<Factor> for Point2D<Dip, Dip>
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
*=
operation. Read moresource§impl MulAssign<Factor> for Point2D<Px, Px>
impl MulAssign<Factor> for Point2D<Px, Px>
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
*=
operation. Read moresource§impl MulAssign<Factor> for Point2D<f32, Px>
impl MulAssign<Factor> for Point2D<f32, Px>
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
*=
operation. Read moresource§impl MulAssign<Factor> for Px
impl MulAssign<Factor> for Px
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
*=
operation. Read moresource§impl MulAssign<Factor> for Rect<Dip, Dip>
impl MulAssign<Factor> for Rect<Dip, Dip>
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
*=
operation. Read moresource§impl MulAssign<Factor> for Rect<Px, Px>
impl MulAssign<Factor> for Rect<Px, Px>
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
*=
operation. Read moresource§impl MulAssign<Factor> for Size2D<Dip, Dip>
impl MulAssign<Factor> for Size2D<Dip, Dip>
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
*=
operation. Read moresource§impl MulAssign<Factor> for Size2D<Px, Px>
impl MulAssign<Factor> for Size2D<Px, Px>
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
*=
operation. Read moresource§impl MulAssign<Factor> for Size2D<f32, Px>
impl MulAssign<Factor> for Size2D<f32, Px>
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
*=
operation. Read moresource§impl MulAssign<Factor> for Vector2D<Dip, Dip>
impl MulAssign<Factor> for Vector2D<Dip, Dip>
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
*=
operation. Read moresource§impl MulAssign<Factor> for Vector2D<Px, Px>
impl MulAssign<Factor> for Vector2D<Px, Px>
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
*=
operation. Read moresource§impl MulAssign<Factor> for ZIndex
impl MulAssign<Factor> for ZIndex
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
*=
operation. Read moresource§impl MulAssign<Factor> for usize
impl MulAssign<Factor> for usize
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
*=
operation. Read moresource§impl MulAssign for Factor
impl MulAssign for Factor
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
*=
operation. Read moresource§impl PartialOrd for Factor
impl PartialOrd for Factor
source§impl SelectorValue for Factor
impl SelectorValue for Factor
source§impl Serialize for Factor
impl Serialize for Factor
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,
source§impl SubAssign for Factor
impl SubAssign for Factor
source§fn sub_assign(&mut self, rhs: Factor)
fn sub_assign(&mut self, rhs: Factor)
-=
operation. Read moresource§impl Transitionable for Factor
impl Transitionable for Factor
impl Copy for Factor
impl IntoValue<Align> for Factor
impl IntoValue<CornerRadius> for Factor
impl IntoValue<EasingTime> for Factor
impl IntoValue<Factor> for FactorPercent
impl IntoValue<Factor> for Progress
impl IntoValue<Factor> for bool
impl IntoValue<Factor> for f32
impl IntoValue<Factor2d> for Factor
impl IntoValue<FactorPercent> for Factor
impl IntoValue<FactorSideOffsets> for Factor
impl IntoValue<FontStretch> for Factor
impl IntoValue<GradientRadius> for Factor
impl IntoValue<GradientStop> for Factor
impl IntoValue<GridSpacing> for Factor
impl IntoValue<Length> for Factor
impl IntoValue<Point> for Factor
impl IntoValue<Progress> for Factor
impl IntoValue<SideOffsets> for Factor
impl IntoValue<Size> for Factor
impl IntoValue<Vector> for Factor
impl Pod for Factor
Auto Trait Implementations§
impl Freeze for Factor
impl RefUnwindSafe for Factor
impl Send for Factor
impl Sync for Factor
impl Unpin for Factor
impl UnwindSafe for Factor
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
source§impl<T> AnyVarValue for Twhere
T: VarValue,
impl<T> AnyVarValue for Twhere
T: VarValue,
source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
dyn Any
methods.source§fn clone_boxed(&self) -> Box<dyn AnyVarValue>
fn clone_boxed(&self) -> Box<dyn AnyVarValue>
source§fn clone_boxed_var(&self) -> Box<dyn AnyVar>
fn clone_boxed_var(&self) -> Box<dyn AnyVar>
LocalVar<Self>
.source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
self
equals other
.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
§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
§type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
.§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self
.source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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
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