Skip to main content

Class

Enum Class 

Source
pub enum Class {
    Spatial,
    Scale,
    Opacity,
    Color,
    Gesture,
    Other,
}
Expand description

The kind of a moving value. It sets how close counts as settled and what reduced motion does. Effect classes (opacity, colour) never overshoot: their samples stay between the start and the target.

Variants§

§

Spatial

Positions and sizes in points.

§

Scale

A scale factor around 1.

§

Opacity

An alpha 0..=1. An effect: never overshoots.

§

Color

Colour lanes (OKLab). An effect: never overshoots.

§

Gesture

A value under the user’s hand (a drag or fling): reduced motion leaves it alone.

§

Other

Anything else (a progress number…).

Implementations§

Source§

impl Class

Source

pub fn eps(self, pixels_per_point: f32) -> Eps

Settle thresholds for this class on a display with pixels_per_point (NaN is 1, clamped to 0.25..=16). Spatial and gesture values settle within a quarter of a physical pixel.

Source

pub const fn is_effect(self) -> bool

Whether this class is an effect (opacity, colour) that must not overshoot.

Source

pub const fn reduce(self, curve: Curve) -> Curve

The curve to use instead of curve under reduced motion: spatial, scale and other values jump; opacity and colour take a short fade (crate::tokens::REDUCED_FADE); a gesture keeps its curve (the user’s own hand is never slowed or removed).

Trait Implementations§

Source§

impl Clone for Class

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Class

Source§

impl Debug for Class

Source§

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

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

impl Default for Class

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for Class

Source§

impl Hash for Class

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Class

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Class

Auto Trait Implementations§

§

impl Forget for Class

§

impl Freeze for Class

§

impl Move for Class

§

impl RefUnwindSafe for Class

§

impl Send for Class

§

impl Sync for Class

§

impl Unpin for Class

§

impl UnsafeUnpin for Class

§

impl UnwindSafe for Class

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> 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, dest: *mut u8)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.