pub enum ControlFlow {
Poll,
Wait,
WaitUntil(Instant),
}
Expand description
Set through ActiveEventLoop::set_control_flow()
.
Indicates the desired behavior of the event loop after Event::AboutToWait
is emitted.
Defaults to Wait
.
Variants§
Poll
When the current loop iteration finishes, immediately begin a new iteration regardless of whether or not new events are available to process.
Wait
When the current loop iteration finishes, suspend the thread until another event arrives.
WaitUntil(Instant)
When the current loop iteration finishes, suspend the thread until either another event arrives or the given time is reached.
Useful for implementing efficient timers. Applications which want to render at the
display’s native refresh rate should instead use Poll
and the VSync functionality
of a graphics API to reduce odds of missed frames.
Implementations§
Source§impl ControlFlow
impl ControlFlow
Sourcepub fn wait_duration(timeout: Duration) -> Self
pub fn wait_duration(timeout: Duration) -> Self
Creates a ControlFlow
that waits until a timeout has expired.
In most cases, this is set to WaitUntil
. However, if the timeout overflows, it is
instead set to Wait
.
Trait Implementations§
Source§impl Clone for ControlFlow
impl Clone for ControlFlow
Source§fn clone(&self) -> ControlFlow
fn clone(&self) -> ControlFlow
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more