Skip to content
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

Remove TrustedWindowHandle #73

Merged
merged 2 commits into from Nov 19, 2021

Conversation

maroider
Copy link
Member

@maroider maroider commented Nov 15, 2021

As per @Lokathor's request in #72, I have made some changes that I believe need to be made.

  1. I removed TrustedWindowHandle as its usefulness is somewhat dubious.
  2. I added extra impls for HasRawWindowHandle as proposed in Improve safety around HasRawWindowHandle #71.
    I believe these impls represent a decent enough usability improvement to be added as-is.

cc @pythonesque

PS: I missed a 0. in the branch name, lol

Its usefulness is dubious at best
src/lib.rs Show resolved Hide resolved
src/lib.rs Outdated
Comment on lines 57 to 75
unsafe impl<'a, T: HasRawWindowHandle> HasRawWindowHandle for &'a T {
fn raw_window_handle(&self) -> RawWindowHandle {
(*self).raw_window_handle()
}
}
unsafe impl<T: HasRawWindowHandle> HasRawWindowHandle for alloc::rc::Rc<T> {
fn raw_window_handle(&self) -> RawWindowHandle {
(**self).raw_window_handle()
}
}
unsafe impl<T: HasRawWindowHandle> HasRawWindowHandle for alloc::sync::Arc<T> {
fn raw_window_handle(&self) -> RawWindowHandle {
(**self).raw_window_handle()
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with adding these impls since they are consistent with the current wording of the safety guarantees implementors of HasRawWindowHandle must uphold.

If we find in #71 or likewise that the safety guarantees should change, we can then consider if these impls should change as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's my general reasoning behind pushing this through for now.

@maroider
Copy link
Member Author

The impls for Rc<T> and Arc<T> should be behind the new alloc feature now.

@Lokathor
Copy link
Contributor

This looks good. I'll merge it and publish later today.

Publishing as 0.4.1 should be fine, since the averted 0.4.0 was only out for like 20 minutes.

@Lokathor Lokathor merged commit 820370a into rust-windowing:master Nov 19, 2021
@Lokathor
Copy link
Contributor

https://docs.rs/raw-window-handle/0.4.1/raw_window_handle/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants