Skip to main content

ClampedSimulation

Struct ClampedSimulation 

Source
pub struct ClampedSimulation<S>
where S: Simulation,
{ /* private fields */ }
Expand description

The shared animation layer — physics, curves, driver — see frus_core::animation. Re-exported here so applications can reach it through frus_widgets without depending on frus-core directly. Pins a simulation’s position into [min, max]; the velocity keeps reporting the underlying simulation’s. This is what scrolling needs: momentum is computed freely, but the offset never leaves the bounds.

Implementations§

Source§

impl<S> ClampedSimulation<S>
where S: Simulation,

Source

pub fn new(inner: S, min: f32, max: f32) -> ClampedSimulation<S>

Wraps inner, constraining its position to [min, max].

Trait Implementations§

Source§

impl<S> Simulation for ClampedSimulation<S>
where S: Simulation,

Source§

fn x(&self, time: f32) -> f32

The position at instant time.
Source§

fn dx(&self, time: f32) -> f32

The velocity — the derivative of position — at instant time.
Source§

fn is_done(&self, time: f32) -> bool

true once the motion has finished, within the tolerances.
Source§

fn tolerance(&self) -> Tolerance

The stopping thresholds.

Auto Trait Implementations§

§

impl<S> Freeze for ClampedSimulation<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for ClampedSimulation<S>
where S: RefUnwindSafe,

§

impl<S> Send for ClampedSimulation<S>
where S: Send,

§

impl<S> Sync for ClampedSimulation<S>
where S: Sync,

§

impl<S> Unpin for ClampedSimulation<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for ClampedSimulation<S>
where S: UnsafeUnpin,

§

impl<S> UnwindSafe for ClampedSimulation<S>
where S: UnwindSafe,

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> 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<Msg> IntoMsg<Msg> for Msg

Source§

fn defer(work: impl Fn() -> Msg + 'static) -> Msg

The message that stands for work’s result.
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.