Conversation
madsmtm
left a comment
There was a problem hiding this comment.
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 <[email protected]>
Signed-off-by: John Nunley <[email protected]>
Signed-off-by: John Nunley <[email protected]>
Signed-off-by: John Nunley <[email protected]>
Signed-off-by: John Nunley <[email protected]>
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.