#[non_exhaustive]pub struct RunOptions { /* private fields */ }Expand description
Options controlling run_blocking_with’s pacing and idle behavior.
Implementations§
Source§impl RunOptions
impl RunOptions
Sourcepub const fn animated(target_fps: u32) -> Self
pub const fn animated(target_fps: u32) -> Self
Options for a continuously-rendering, target_fps-paced loop.
event_driven is false: Flow::Idle only skips present, it
never blocks. Use this for apps that drive a retroglyph_ui::Tween/
FrameClock from Frame::delta and need update
called every tick regardless of input.
target_fps becomes RunOptions::target_fps verbatim, including 0: passing 0 here
builds without panicking, but run_blocking_with panics once it constructs the
FrameClock that paces it (see that function’s
# Panics section).
Sourcepub const fn with_target_fps(self, target_fps: u32) -> Self
pub const fn with_target_fps(self, target_fps: u32) -> Self
Caps the loop at this many App::update calls per second whenever a frame actually
runs, using a FrameClock internally to pace them
evenly. None (the default) runs uncapped: as fast as update allows for back-to-back
Flow::Continue frames, or immediately after whatever woke an
event_driven loop from Flow::Idle.
Sourcepub const fn target_fps(&self) -> Option<u32>
pub const fn target_fps(&self) -> Option<u32>
Returns the configured target_fps cap, if any.
Sourcepub const fn event_driven(self, event_driven: bool) -> Self
pub const fn event_driven(self, event_driven: bool) -> Self
On Flow::Idle, block on input instead of calling update again immediately.
true (the default) is right for turn-based, event-driven apps that are idle most of the
time: an idle frame costs approximately nothing, blocked in the backend’s input read
rather than spinning update as fast as the host can manage. false keeps Flow::Idle
non-blocking (skip present, keep looping at whatever rate
target_fps allows): right for apps that animate from
Frame::delta and only return Idle between animation-driven Continue frames, where
blocking would freeze the animation until the next stray input event. See
RunOptions::animated for that shape.
Sourcepub const fn is_event_driven(&self) -> bool
pub const fn is_event_driven(&self) -> bool
Returns whether Flow::Idle blocks on input rather than looping immediately.
Sourcepub const fn with_idle_wake(self, idle_wake: Duration) -> Self
pub const fn with_idle_wake(self, idle_wake: Duration) -> Self
When is_event_driven is true, the longest an idle loop blocks
before calling update again anyway, even with no input. None (the default) blocks
indefinitely: right for apps with nothing to redraw until input arrives. Some(d)
additionally wakes the loop every d, for apps that need a periodic idle redraw (a
blinking cursor, a clock) without paying full frame-rate cost. Ignored when
is_event_driven is false.
Trait Implementations§
Source§impl Clone for RunOptions
impl Clone for RunOptions
Source§fn clone(&self) -> RunOptions
fn clone(&self) -> RunOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RunOptions
impl Debug for RunOptions
Source§impl Default for RunOptions
impl Default for RunOptions
Source§fn default() -> Self
fn default() -> Self
Event-driven, uncapped, blocks indefinitely on Flow::Idle: see run_blocking.
Source§impl PartialEq for RunOptions
impl PartialEq for RunOptions
Source§fn eq(&self, other: &RunOptions) -> bool
fn eq(&self, other: &RunOptions) -> bool
self and other values to be equal, and is used by ==.impl Copy for RunOptions
impl Eq for RunOptions
impl StructuralPartialEq for RunOptions
Auto Trait Implementations§
impl Freeze for RunOptions
impl RefUnwindSafe for RunOptions
impl Send for RunOptions
impl Sync for RunOptions
impl Unpin for RunOptions
impl UnsafeUnpin for RunOptions
impl UnwindSafe for RunOptions
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,
§impl<C> WithAlpha for Cwhere
C: Copy,
impl<C> WithAlpha for Cwhere
C: Copy,
§fn with_alpha_first<A>(self, alpha: A) -> AlphaFirst<A, Self>
fn with_alpha_first<A>(self, alpha: A) -> AlphaFirst<A, Self>
self with alpha, storing alpha before the color in memory
(see [AlphaFirst]).§fn with_alpha_last<A>(self, alpha: A) -> AlphaLast<A, Self>
fn with_alpha_last<A>(self, alpha: A) -> AlphaLast<A, Self>
self with alpha, storing alpha after the color in memory
(see [AlphaLast]).