zng_layout::unit

Struct FactorPercent

source
pub struct FactorPercent(pub f32);
Expand description

Multiplication factor in percentage (0%-100%).

See FactorUnits for more details.

§Equality

Equality is determined using about_eq with 0.001 epsilon.

Tuple Fields§

§0: f32

Implementations§

source§

impl FactorPercent

source

pub fn clamp_range(self) -> FactorPercent

Clamp factor to [0.0..=100.0] range.

source

pub fn fct(self) -> Factor

Convert to Factor.

Trait Implementations§

source§

impl Add for FactorPercent

source§

type Output = FactorPercent

The resulting type after applying the + operator.
source§

fn add(self, rhs: FactorPercent) -> <FactorPercent as Add>::Output

Performs the + operation. Read more
source§

impl AddAssign for FactorPercent

source§

fn add_assign(&mut self, rhs: FactorPercent)

Performs the += operation. Read more
source§

impl Clone for FactorPercent

source§

fn clone(&self) -> FactorPercent

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for FactorPercent

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for FactorPercent

source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<FactorPercent, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for FactorPercent

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Div<Factor> for FactorPercent

source§

type Output = FactorPercent

The resulting type after applying the / operator.
source§

fn div(self, rhs: Factor) -> FactorPercent

Performs the / operation. Read more
source§

impl Div for FactorPercent

source§

type Output = FactorPercent

The resulting type after applying the / operator.
source§

fn div(self, rhs: FactorPercent) -> <FactorPercent as Div>::Output

Performs the / operation. Read more
source§

impl DivAssign<Factor> for FactorPercent

source§

fn div_assign(&mut self, rhs: Factor)

Performs the /= operation. Read more
source§

impl DivAssign for FactorPercent

source§

fn div_assign(&mut self, rhs: FactorPercent)

Performs the /= operation. Read more
source§

impl From<Factor> for FactorPercent

source§

fn from(value: Factor) -> FactorPercent

Converts to this type from the input type.
source§

impl From<FactorPercent> for Align

source§

fn from(xy: FactorPercent) -> Self

Converts to this type from the input type.
source§

impl From<FactorPercent> for Factor

source§

fn from(value: FactorPercent) -> Factor

Converts to this type from the input type.
source§

impl From<FactorPercent> for Factor2d

source§

fn from(xy: FactorPercent) -> Self

Converts to this type from the input type.
source§

impl From<FactorPercent> for FactorSideOffsets

source§

fn from(percent: FactorPercent) -> Self

All sides equal.

source§

impl From<FactorPercent> for GridSpacing

source§

fn from(percent: FactorPercent) -> Self

Column and row equal relative length.

source§

impl From<FactorPercent> for Length

source§

fn from(percent: FactorPercent) -> Self

Conversion to Length::Factor

source§

impl From<FactorPercent> for Point

source§

fn from(percent: FactorPercent) -> Self

Splat relative length.

source§

impl From<FactorPercent> for RgbaComponent

Color channel value is in the [0..=100] range.

source§

fn from(p: FactorPercent) -> RgbaComponent

Converts to this type from the input type.
source§

impl From<FactorPercent> for SideOffsets

source§

fn from(percent: FactorPercent) -> Self

All sides equal relative length.

source§

impl From<FactorPercent> for Size

source§

fn from(percent: FactorPercent) -> Self

Splat relative length.

source§

impl From<FactorPercent> for Vector

source§

fn from(percent: FactorPercent) -> Self

Conversion to Length::Factor then to vector.

source§

impl IntoVar<Align> for FactorPercent

source§

type Var = LocalVar<Align>

Variable type that will wrap the T value. Read more
source§

fn into_var(self) -> Self::Var

Converts the source value into a var.
source§

fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>
where Self: Sized,

Converts into BoxedVar<T>. Read more
source§

impl IntoVar<Factor> for FactorPercent

source§

type Var = LocalVar<Factor>

Variable type that will wrap the T value. Read more
source§

fn into_var(self) -> <FactorPercent as IntoVar<Factor>>::Var

Converts the source value into a var.
source§

fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>
where Self: Sized,

Converts into BoxedVar<T>. Read more
source§

impl IntoVar<Factor2d> for FactorPercent

source§

type Var = LocalVar<Factor2d>

Variable type that will wrap the T value. Read more
source§

fn into_var(self) -> Self::Var

Converts the source value into a var.
source§

fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>
where Self: Sized,

Converts into BoxedVar<T>. Read more
source§

impl IntoVar<FactorPercent> for Factor

source§

type Var = LocalVar<FactorPercent>

Variable type that will wrap the T value. Read more
source§

fn into_var(self) -> <Factor as IntoVar<FactorPercent>>::Var

Converts the source value into a var.
source§

fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>
where Self: Sized,

Converts into BoxedVar<T>. Read more
source§

impl IntoVar<FactorSideOffsets> for FactorPercent

source§

fn into_var(self) -> Self::Var

All sides equal.

source§

type Var = LocalVar<FactorSideOffsets>

Variable type that will wrap the T value. Read more
source§

fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>
where Self: Sized,

Converts into BoxedVar<T>. Read more
source§

impl IntoVar<GridSpacing> for FactorPercent

source§

fn into_var(self) -> Self::Var

Column and row equal relative length.

source§

type Var = LocalVar<GridSpacing>

Variable type that will wrap the T value. Read more
source§

fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>
where Self: Sized,

Converts into BoxedVar<T>. Read more
source§

impl IntoVar<Length> for FactorPercent

source§

fn into_var(self) -> Self::Var

Conversion to Length::Factor

source§

type Var = LocalVar<Length>

Variable type that will wrap the T value. Read more
source§

fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>
where Self: Sized,

Converts into BoxedVar<T>. Read more
source§

impl IntoVar<Point> for FactorPercent

source§

fn into_var(self) -> Self::Var

Splat relative length.

source§

type Var = LocalVar<Point>

Variable type that will wrap the T value. Read more
source§

fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>
where Self: Sized,

Converts into BoxedVar<T>. Read more
source§

impl IntoVar<SideOffsets> for FactorPercent

source§

fn into_var(self) -> Self::Var

All sides equal relative length.

source§

type Var = LocalVar<SideOffsets>

Variable type that will wrap the T value. Read more
source§

fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>
where Self: Sized,

Converts into BoxedVar<T>. Read more
source§

impl IntoVar<Size> for FactorPercent

source§

fn into_var(self) -> Self::Var

Splat relative length.

source§

type Var = LocalVar<Size>

Variable type that will wrap the T value. Read more
source§

fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>
where Self: Sized,

Converts into BoxedVar<T>. Read more
source§

impl IntoVar<Vector> for FactorPercent

source§

fn into_var(self) -> Self::Var

Conversion to Length::Factor then to vector.

source§

type Var = LocalVar<Vector>

Variable type that will wrap the T value. Read more
source§

fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>
where Self: Sized,

Converts into BoxedVar<T>. Read more
source§

impl Mul<Factor> for FactorPercent

source§

type Output = FactorPercent

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Factor) -> FactorPercent

Performs the * operation. Read more
source§

impl Mul for FactorPercent

source§

type Output = FactorPercent

The resulting type after applying the * operator.
source§

fn mul(self, rhs: FactorPercent) -> <FactorPercent as Mul>::Output

Performs the * operation. Read more
source§

impl MulAssign<Factor> for FactorPercent

source§

fn mul_assign(&mut self, rhs: Factor)

Performs the *= operation. Read more
source§

impl MulAssign for FactorPercent

source§

fn mul_assign(&mut self, rhs: FactorPercent)

Performs the *= operation. Read more
source§

impl Neg for FactorPercent

source§

type Output = FactorPercent

The resulting type after applying the - operator.
source§

fn neg(self) -> <FactorPercent as Neg>::Output

Performs the unary - operation. Read more
source§

impl PartialEq for FactorPercent

source§

fn eq(&self, other: &FactorPercent) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for FactorPercent

source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Sub for FactorPercent

source§

type Output = FactorPercent

The resulting type after applying the - operator.
source§

fn sub(self, rhs: FactorPercent) -> <FactorPercent as Sub>::Output

Performs the - operation. Read more
source§

impl SubAssign for FactorPercent

source§

fn sub_assign(&mut self, rhs: FactorPercent)

Performs the -= operation. Read more
source§

impl Copy for FactorPercent

source§

impl IntoValue<Align> for FactorPercent

source§

impl IntoValue<Factor> for FactorPercent

source§

impl IntoValue<Factor2d> for FactorPercent

source§

impl IntoValue<FactorPercent> for Factor

source§

impl IntoValue<FactorSideOffsets> for FactorPercent

source§

impl IntoValue<GridSpacing> for FactorPercent

source§

impl IntoValue<Length> for FactorPercent

source§

impl IntoValue<Point> for FactorPercent

source§

impl IntoValue<SideOffsets> for FactorPercent

source§

impl IntoValue<Size> for FactorPercent

source§

impl IntoValue<Vector> for FactorPercent

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> AnyVarValue for T
where T: VarValue,

source§

fn as_any(&self) -> &(dyn Any + 'static)

Access to dyn Any methods.
source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Access to mut dyn Any methods.
source§

fn clone_boxed(&self) -> Box<dyn AnyVarValue>

Clone the value.
source§

fn clone_boxed_var(&self) -> Box<dyn AnyVar>

Clone the value into a new boxed LocalVar<Self>.
source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Access to Box<dyn Any> methods.
source§

fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool

Gets if self equals other.
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
source§

impl<T> IntoVar<T> for T
where T: VarValue,

source§

type Var = LocalVar<T>

Variable type that will wrap the T value. Read more
source§

fn into_var(self) -> <T as IntoVar<T>>::Var

Converts the source value into a var.
source§

fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>
where Self: Sized,

Converts into BoxedVar<T>. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T> ToTxt for T
where T: ToString,

source§

fn to_txt(&self) -> Txt

Converts the given value to an owned Txt. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T> IntoValue<T> for T
where T: VarValue,

source§

impl<T> VarValue for T
where T: Debug + Clone + PartialEq + Any + Send + Sync,