pub struct Chase { /* private fields */ }Expand description
One number on its way to another.
Exponential rather than linear, for a reason that is about streaming rather than about taste: the target moves. A claim lands, then another, then a price — a linear tween would have to be restarted on each one and would visibly stutter, where an approach simply has a new gap to close and keeps its speed continuous.
Implementations§
Source§impl Chase
impl Chase
Sourcepub fn advance(&mut self, target: u64, now: Instant) -> u64
pub fn advance(&mut self, target: u64, now: Instant) -> u64
Moves toward target by however much time has passed, and says where it got to.
The time constant is a third of COUNT_UP, so about 95% of the gap is closed in that
long — which is what “roughly 200ms” means for a curve that never formally arrives.
Formally never arriving is also why the snap below is not optional.
Sourcepub fn jam(&mut self, value: u64, now: Instant)
pub fn jam(&mut self, value: u64, now: Instant)
Puts the number somewhere without easing toward it.
For a value that is already being interpolated by something else — a row emptying on a ramp — so that the chase takes over seamlessly when that ends rather than resuming from wherever it was left standing.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Chase
impl RefUnwindSafe for Chase
impl Send for Chase
impl Sync for Chase
impl Unpin for Chase
impl UnsafeUnpin for Chase
impl UnwindSafe for Chase
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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