-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Excise the HasRaw*Handle traits #139
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks perfect honestly.
I could potentially see how an implementer might not want to provide the strong guarantees about validity that HasWindowHandle
, but HasRawWindowHandle
already had those guarantees, they were just more implicit, so I think this will be fine!
fcdbcc8
to
297078d
Compare
Removing it outright might be a bit too harsh. I've opted to deprecate it for now. |
Maybe you could add a blanket |
Banger idea, I've implemented this |
What would you say people who don't have borrowing lifetimes on their handles do |
I'm not sure I understand the question, but what would an example of this be? Like, what would be a situation where you, as a "provider" type, would like to say "hey, I have this window handle, its lifetime is not tied to me ( |
So SDL gives you and because pointers are Copy the "lifetime" of that pointer, as the compiler sees it, is not anything sensible because there's all sorts of spots where you'll accidentally get a copy of the value instead of extending the life of a borrow on the pointer, or some other fiddly thing like that. So there's certainly some span of time that's correct (until you call |
Makes sense. In this case, don't implement Instead, expose an /// # Safety
/// The window must not be destroyed for the lifetime of the handle
pub unsafe fn get_handle<'a>(window: *mut SDL_Window) -> WindowHandle<'a> { ... } Note that |
Alright, as long as we've thought about it and we have some answer, then we can proceed |
After reading #135, I've realized that the HasRawDisplayHandle and HasRawWindowHandle traits have little value in a post-borrowed-handle world. Borrowed handles do everything better, and the raw handle can be extracted from the borrowed handle. Therefore it makes sense to remove these traits. Closes #135. Signed-off-by: John Nunley <dev@notgull.net>
Signed-off-by: John Nunley <dev@notgull.net>
Signed-off-by: John Nunley <dev@notgull.net>
Signed-off-by: John Nunley <dev@notgull.net>
87f2174
to
07edc80
Compare
It seems to me that everyone is fine with this, so I'll merge it. |
After reading #135, I've realized that the HasRawDisplayHandle and HasRawWindowHandle traits have little value in a post-borrowed-handle world. Borrowed handles do everything better, and the raw handle can be extracted from the borrowed handle. Therefore it makes sense to remove these traits.
Closes #135.