pub struct FrameThrottle { /* private fields */ }Expand description
Coalesces redraw requests to at most one frame per interval.
Feed it every data update with request. Bursts of updates (say a
hundred trades in a millisecond) turn into one immediate frame and at most one delayed
frame, so the last update is always drawn. Loops that poll instead of scheduling a timer
use poll and timeout.
Implementations§
Source§impl FrameThrottle
impl FrameThrottle
Sourcepub fn new(fps: u32) -> FrameThrottle
pub fn new(fps: u32) -> FrameThrottle
At most fps frames per second (at least 1).
Sourcepub fn with_interval(interval: Duration) -> FrameThrottle
pub fn with_interval(interval: Duration) -> FrameThrottle
At most one frame per interval.
Sourcepub fn is_pending(&self) -> bool
pub fn is_pending(&self) -> bool
Whether a delayed redraw is waiting.
Sourcepub fn frame_drawn(&mut self, now: Instant)
pub fn frame_drawn(&mut self, now: Instant)
Records a frame drawn for another reason (a resize, say) at now.
Trait Implementations§
Source§impl Clone for FrameThrottle
impl Clone for FrameThrottle
Source§impl Debug for FrameThrottle
impl Debug for FrameThrottle
Auto Trait Implementations§
impl Forget for FrameThrottle
impl Freeze for FrameThrottle
impl Move for FrameThrottle
impl RefUnwindSafe for FrameThrottle
impl Send for FrameThrottle
impl Sync for FrameThrottle
impl Unpin for FrameThrottle
impl UnsafeUnpin for FrameThrottle
impl UnwindSafe for FrameThrottle
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
Mutably borrows from an owned value. Read more
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> ⓘ
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 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> ⓘ
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