Make the EventLoopWindowTarget passed to the EventLoop::run callback live for 'static
#2346
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CHANGELOG.mdif knowledge of this change could be valuable to usersUpdated documentation to reflect any user-facing changes, including notes of platform-specific behaviorthis is purely a signature change, so no extra docs are needed on top.Created or updated an example program if it would help users understand this functionalityUpdated feature matrix, if new features were added or implementedThis PR changes the signature of
EventLoop::runto make theEventLoopWindowTargetpassed to the callback live for'static, and changes the signature ofEventLoop::run_returnto make theEventLoopWindowTargetlive for as long as the reference to the event loop.The main motivation for this is writing an async executor on top of winit (ref #1199). Such an executor needs to pass an
EventLoopWindowTargetto the future to create windows with, which then needs to live for the entirety of the future (i.e.,'static).This plus #2294 should make it possible to write an async executor on top of winit.