RFC: Add a forwards compatible impl of HasRawWindowHandle #98
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.
Note: this is still just a WIP implementation because I'm not sure atm how to avoid a conflict with the
?Sized
trait implementation that exists in this crateThis is effectively a variation of the "semver trick" that aims to
provide a blanket implementation of the v0.4 HasRawWindowHandle trait
for anything that implements the newer v0.5 traits
The is to help support compatibility between crates such as Winit 0.27
that have been updated to the latest version of raw_window_handle and
crates like Wgpu 0.13 that are dependent on raw_window_handle 0.4 (and
they can't bump the dependency without a new semver release)
This way crates like Wgpu built against raw_window_handle 0.4 will
be able to query the window handle state they need as a mapping from
the newer state provided by the v0.5 traits.
Alternative Solution
This is a potential, alternative solution to this Winit issue: rust-windowing/winit#2418
One trade off to solving this here instead of in Winit is that it's perhaps more reasonable to delete the implementation before the next release of Winit instead of maintaining it indefinitely - since this is only intended to be a stop-gap solution that makes it easier for crates to adopt Winit 0.27 while Wgpu is not yet able to update to v0.5 of this crate.
Conflicting trait:
This currently has an issue with needing to comment out the blanket
implementation of HasRawWindowHandle for ?Sized reference types since
the compiler complains that the new implementation is in conflict with
that.
I'm not currently sure how to specify the trait bounds so they can exist
together.
This is the conflicting trait impl: