#[non_exhaustive]pub struct RunOptions { /* private fields */ }Expand description
Options controlling run_on_with’s pacing and idle behavior.
Implementations§
Source§impl RunOptions
impl RunOptions
Sourcepub const fn animated(target_fps: u32) -> RunOptions
pub const fn animated(target_fps: u32) -> RunOptions
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::animate::Tween/
FrameClock from Frame::delta and need update
called every tick regardless of input.
target_fps becomes RunOptions::target_fps verbatim, including 0:
run_on_with treats Some(0) as uncapped, the same as None,
rather than deriving a zero-length frame budget from it.
Sourcepub const fn with_target_fps(self, target_fps: u32) -> RunOptions
pub const fn with_target_fps(self, target_fps: u32) -> RunOptions
Caps the loop at this many App::update calls per second whenever a frame actually
runs, sleeping out the remainder of each frame’s budget 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) -> RunOptions
pub const fn event_driven(self, event_driven: bool) -> RunOptions
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) -> RunOptions
pub const fn with_idle_wake(self, idle_wake: Duration) -> RunOptions
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. Builder calls apply in
order: this always switches idle to Idle::Block with idle_wake,
even after a preceding event_driven(false) or
animated; a later event_driven(false) still switches back to
Idle::Spin and drops the wake interval.
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 moreimpl Copy for RunOptions
Source§impl Debug for RunOptions
impl Debug for RunOptions
Source§impl Default for RunOptions
impl Default for RunOptions
Source§fn default() -> RunOptions
fn default() -> RunOptions
Event-driven, uncapped, blocks indefinitely on Flow::Idle: see run_on.
impl Eq for RunOptions
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 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> WasmNotSend for Twhere
T: Send,
impl<T> WasmNotSendSync for Twhere
T: WasmNotSend + WasmNotSync,
impl<T> WasmNotSync for Twhere
T: Sync,
§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]).