Enum winit::event_loop::ControlFlow
source · pub enum ControlFlow {
Poll,
Wait,
WaitUntil(Instant),
}
Expand description
Set through ActiveEventLoop::set_control_flow()
.
Indicates the desired behavior of the event loop after about_to_wait
is called.
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 moresource§impl Debug for ControlFlow
impl Debug for ControlFlow
source§impl Default for ControlFlow
impl Default for ControlFlow
source§fn default() -> ControlFlow
fn default() -> ControlFlow
source§impl Hash for ControlFlow
impl Hash for ControlFlow
source§impl PartialEq for ControlFlow
impl PartialEq for ControlFlow
impl Copy for ControlFlow
impl Eq for ControlFlow
impl StructuralPartialEq for ControlFlow
Auto Trait Implementations§
impl Freeze for ControlFlow
impl RefUnwindSafe for ControlFlow
impl Send for ControlFlow
impl Sync for ControlFlow
impl Unpin for ControlFlow
impl UnwindSafe for ControlFlow
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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§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
.source§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
.source§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.source§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.