Discourage use of WaitUntil to implement VSync (#2230)

This commit is contained in:
Benjamin Saunders 2022-03-31 13:38:02 -07:00 committed by GitHub
parent 6c1d3c4fd8
commit 2ae12fb0a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -140,6 +140,10 @@ pub enum ControlFlow {
Wait,
/// 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.
WaitUntil(Instant),
/// Send a `LoopDestroyed` event and stop the event loop. This variant is *sticky* - once set,
/// `control_flow` cannot be changed from `ExitWithCode`, and any future attempts to do so will