#[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) -> Self
pub fn clamp_range(self) -> Self
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: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moresource§impl<'de> Deserialize<'de> for Factor
impl<'de> Deserialize<'de> for Factor
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 Div<Factor> for FactorPercent
impl Div<Factor> for FactorPercent
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)
Performs the
/=
operation. Read moresource§impl DivAssign<Factor> for Duration
impl DivAssign<Factor> for Duration
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
Performs the
/=
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)
Performs the
/=
operation. Read moresource§impl DivAssign<Factor> for DipPoint
impl DivAssign<Factor> for DipPoint
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
Performs the
/=
operation. Read moresource§impl DivAssign<Factor> for PxPoint
impl DivAssign<Factor> for PxPoint
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
Performs the
/=
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)
Performs the
/=
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)
Performs the
/=
operation. Read moresource§impl DivAssign<Factor> for DipRect
impl DivAssign<Factor> for DipRect
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
Performs the
/=
operation. Read moresource§impl DivAssign<Factor> for PxRect
impl DivAssign<Factor> for PxRect
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
Performs the
/=
operation. Read moresource§impl DivAssign<Factor> for DipSize
impl DivAssign<Factor> for DipSize
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
Performs the
/=
operation. Read moresource§impl DivAssign<Factor> for PxSize
impl DivAssign<Factor> for PxSize
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
Performs the
/=
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)
Performs the
/=
operation. Read moresource§impl DivAssign<Factor> for DipVector
impl DivAssign<Factor> for DipVector
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
Performs the
/=
operation. Read moresource§impl DivAssign<Factor> for PxVector
impl DivAssign<Factor> for PxVector
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
Performs the
/=
operation. Read moresource§impl DivAssign<Factor> for f32
impl DivAssign<Factor> for f32
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
Performs the
/=
operation. Read moresource§impl DivAssign<Factor> for f64
impl DivAssign<Factor> for f64
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
Performs the
/=
operation. Read moresource§impl DivAssign<Factor> for i128
impl DivAssign<Factor> for i128
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
Performs the
/=
operation. Read moresource§impl DivAssign<Factor> for i16
impl DivAssign<Factor> for i16
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
Performs the
/=
operation. Read moresource§impl DivAssign<Factor> for i32
impl DivAssign<Factor> for i32
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
Performs the
/=
operation. Read moresource§impl DivAssign<Factor> for i64
impl DivAssign<Factor> for i64
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
Performs the
/=
operation. Read moresource§impl DivAssign<Factor> for i8
impl DivAssign<Factor> for i8
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
Performs the
/=
operation. Read moresource§impl DivAssign<Factor> for isize
impl DivAssign<Factor> for isize
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
Performs the
/=
operation. Read moresource§impl DivAssign<Factor> for u128
impl DivAssign<Factor> for u128
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
Performs the
/=
operation. Read moresource§impl DivAssign<Factor> for u16
impl DivAssign<Factor> for u16
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
Performs the
/=
operation. Read moresource§impl DivAssign<Factor> for u32
impl DivAssign<Factor> for u32
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
Performs the
/=
operation. Read moresource§impl DivAssign<Factor> for u64
impl DivAssign<Factor> for u64
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
Performs the
/=
operation. Read moresource§impl DivAssign<Factor> for u8
impl DivAssign<Factor> for u8
source§fn div_assign(&mut self, rhs: Factor)
fn div_assign(&mut self, rhs: Factor)
Performs the
/=
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)
Performs the
/=
operation. Read moresource§impl DivAssign for Factor
impl DivAssign for Factor
source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
Performs the
/=
operation. Read moresource§impl From<Factor> for FactorPercent
impl From<Factor> for FactorPercent
source§impl From<Factor> for RgbaComponent
impl From<Factor> for RgbaComponent
Color channel value is in the [0..=1] range.
source§impl From<FactorPercent> for Factor
impl From<FactorPercent> for Factor
source§fn from(value: FactorPercent) -> Self
fn from(value: FactorPercent) -> Self
Converts to this type from the input type.
source§impl Mul<Factor> for FactorPercent
impl Mul<Factor> for FactorPercent
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)
Performs the
*=
operation. Read moresource§impl MulAssign<Factor> for Duration
impl MulAssign<Factor> for Duration
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
Performs the
*=
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)
Performs the
*=
operation. Read moresource§impl MulAssign<Factor> for DipPoint
impl MulAssign<Factor> for DipPoint
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
Performs the
*=
operation. Read moresource§impl MulAssign<Factor> for PxPoint
impl MulAssign<Factor> for PxPoint
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
Performs the
*=
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)
Performs the
*=
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)
Performs the
*=
operation. Read moresource§impl MulAssign<Factor> for DipRect
impl MulAssign<Factor> for DipRect
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
Performs the
*=
operation. Read moresource§impl MulAssign<Factor> for PxRect
impl MulAssign<Factor> for PxRect
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
Performs the
*=
operation. Read moresource§impl MulAssign<Factor> for DipSize
impl MulAssign<Factor> for DipSize
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
Performs the
*=
operation. Read moresource§impl MulAssign<Factor> for PxSize
impl MulAssign<Factor> for PxSize
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
Performs the
*=
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)
Performs the
*=
operation. Read moresource§impl MulAssign<Factor> for DipVector
impl MulAssign<Factor> for DipVector
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
Performs the
*=
operation. Read moresource§impl MulAssign<Factor> for PxVector
impl MulAssign<Factor> for PxVector
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
Performs the
*=
operation. Read moresource§impl MulAssign<Factor> for f32
impl MulAssign<Factor> for f32
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
Performs the
*=
operation. Read moresource§impl MulAssign<Factor> for f64
impl MulAssign<Factor> for f64
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
Performs the
*=
operation. Read moresource§impl MulAssign<Factor> for i128
impl MulAssign<Factor> for i128
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
Performs the
*=
operation. Read moresource§impl MulAssign<Factor> for i16
impl MulAssign<Factor> for i16
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
Performs the
*=
operation. Read moresource§impl MulAssign<Factor> for i32
impl MulAssign<Factor> for i32
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
Performs the
*=
operation. Read moresource§impl MulAssign<Factor> for i64
impl MulAssign<Factor> for i64
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
Performs the
*=
operation. Read moresource§impl MulAssign<Factor> for i8
impl MulAssign<Factor> for i8
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
Performs the
*=
operation. Read moresource§impl MulAssign<Factor> for isize
impl MulAssign<Factor> for isize
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
Performs the
*=
operation. Read moresource§impl MulAssign<Factor> for u128
impl MulAssign<Factor> for u128
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
Performs the
*=
operation. Read moresource§impl MulAssign<Factor> for u16
impl MulAssign<Factor> for u16
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
Performs the
*=
operation. Read moresource§impl MulAssign<Factor> for u32
impl MulAssign<Factor> for u32
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
Performs the
*=
operation. Read moresource§impl MulAssign<Factor> for u64
impl MulAssign<Factor> for u64
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
Performs the
*=
operation. Read moresource§impl MulAssign<Factor> for u8
impl MulAssign<Factor> for u8
source§fn mul_assign(&mut self, rhs: Factor)
fn mul_assign(&mut self, rhs: Factor)
Performs the
*=
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)
Performs the
*=
operation. Read moresource§impl MulAssign for Factor
impl MulAssign for Factor
source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*=
operation. Read moresource§impl PartialOrd for Factor
impl PartialOrd for Factor
source§impl SubAssign for Factor
impl SubAssign for Factor
source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-=
operation. Read moreimpl Copy 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§
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
§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
If this function returns true, then it must be valid to reinterpret
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)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)