pub struct TimerVsyncPacer { /* private fields */ }Expand description
Portable, zero-allocation refresh-rate timer pacer computing next_deadline_us in
microseconds for event loops that sleep via WaitUntil.
Implementations§
Source§impl TimerVsyncPacer
impl TimerVsyncPacer
Sourcepub const fn new(millihertz: u32) -> Self
pub const fn new(millihertz: u32) -> Self
Creates a stopped timer pacer configured for millihertz (clamping < 1_000 to 60_000).
Sourcepub const fn refresh_rate_millihertz(&self) -> u32
pub const fn refresh_rate_millihertz(&self) -> u32
Returns the active refresh rate in millihertz.
Sourcepub fn set_refresh_rate_millihertz(&mut self, millihertz: u32)
pub fn set_refresh_rate_millihertz(&mut self, millihertz: u32)
Updates the configured refresh rate in millihertz (clamping < 1_000 to 60_000).
Trait Implementations§
Source§impl Clone for TimerVsyncPacer
impl Clone for TimerVsyncPacer
impl Copy for TimerVsyncPacer
Source§impl Debug for TimerVsyncPacer
impl Debug for TimerVsyncPacer
Source§impl Default for TimerVsyncPacer
impl Default for TimerVsyncPacer
impl Eq for TimerVsyncPacer
Source§impl PartialEq for TimerVsyncPacer
impl PartialEq for TimerVsyncPacer
impl StructuralPartialEq for TimerVsyncPacer
Source§impl VsyncPacer for TimerVsyncPacer
impl VsyncPacer for TimerVsyncPacer
Source§fn set_active(&mut self, active: bool)
fn set_active(&mut self, active: bool)
Starts (
true) or pauses (false) frame delivery. Idle pacers MUST consume 0% CPU.Source§fn nominal_interval_us(&self) -> Option<u32>
fn nominal_interval_us(&self) -> Option<u32>
Nominal frame interval in microseconds if known (e.g.
8_333 for 120 Hz ProMotion).Source§fn next_deadline_us(
&self,
last_frame_us: Option<u64>,
now_us: u64,
) -> Option<u64>
fn next_deadline_us( &self, last_frame_us: Option<u64>, now_us: u64, ) -> Option<u64>
Optional next wake deadline in microseconds (
now_us clock) for timer/poll pacers.
Push-driven native pacers (CADisplayLink, DwmFlush, rAF) return None.Source§fn on_tick_received(&self)
fn on_tick_received(&self)
Acknowledges receipt of a delivered vsync tick so push-driven pacers can clear their
coalescing latch and emit the next frame tick.
Auto Trait Implementations§
impl Forget for TimerVsyncPacer
impl Freeze for TimerVsyncPacer
impl Move for TimerVsyncPacer
impl RefUnwindSafe for TimerVsyncPacer
impl Send for TimerVsyncPacer
impl Sync for TimerVsyncPacer
impl Unpin for TimerVsyncPacer
impl UnsafeUnpin for TimerVsyncPacer
impl UnwindSafe for TimerVsyncPacer
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