pub struct Reveal { /* private fields */ }Expand description
A paced cursor over streamed units — grapheme clusters, rows, blocks — that chases a growing total and settles once even with it.
Unlike the phase-arithmetic shapes, this is an integrator: each
advance moves an internal cursor forward, in two
regimes. While the backlog exceeds one horizon’s worth of the floor
rate it decays exponentially with e-folding time horizon, so a
bursty producer accelerates the reveal instead of queueing behind it;
the remainder drains linearly at Reveal::MIN_RATE units per
second, so the tail types out steadily rather than slowing
asymptotically.
Progress per sample is capped at one FRAME of elapsed time, so the
cursor follows frames actually observed — like a fixed-cadence
interval timer. Stale paint clocks, stalled hosts, idle gaps, and a
settled cursor awaiting more content all resume at the frame cadence
instead of jumping. <text> consumes this declaratively through the
reveal property — see crate::Props::reveal.
Implementations§
Source§impl Reveal
impl Reveal
Sourcepub fn advance(
&mut self,
now: Duration,
total: usize,
horizon: Duration,
) -> usize
pub fn advance( &mut self, now: Duration, total: usize, horizon: Duration, ) -> usize
Advances the cursor toward total at now and returns the whole
units revealed. A zero horizon snaps to total; a total below
the cursor clamps it down (content shrank in place).
Sourcepub fn is_settled(&self, total: usize) -> bool
pub fn is_settled(&self, total: usize) -> bool
Whether the cursor has caught up with total.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Reveal
impl RefUnwindSafe for Reveal
impl Send for Reveal
impl Sync for Reveal
impl Unpin for Reveal
impl UnsafeUnpin for Reveal
impl UnwindSafe for Reveal
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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