Skip to content

Remove TrustedWindowHandle#73

Merged
Lokathor merged 2 commits intorust-windowing:masterfrom
maroider:4.0-final-final-final
Nov 19, 2021
Merged

Remove TrustedWindowHandle#73
Lokathor merged 2 commits intorust-windowing:masterfrom
maroider:4.0-final-final-final

Conversation

@maroider
Copy link
Copy Markdown
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
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
Copy Markdown
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
Copy Markdown
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 maroider force-pushed the 4.0-final-final-final branch from 5593f6e to 9d0770c Compare November 17, 2021 05:42
@maroider
Copy link
Copy Markdown
Member Author

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

@Lokathor
Copy link
Copy Markdown
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
Copy Markdown
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.

3 participants