Skip to content

Commit

Permalink
Breaking: Make WebWindowHandle and Win32WindowHandle !Send and !Sync
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Mar 21, 2024
1 parent 83e5785 commit 191fffe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,9 +463,9 @@ mod tests {
assert_not_impl_any!(WaylandWindowHandle: Send, Sync);
assert_impl_all!(DrmWindowHandle: Send, Sync);
assert_not_impl_any!(GbmWindowHandle: Send, Sync);
assert_impl_all!(Win32WindowHandle: Send, Sync);
assert_not_impl_any!(Win32WindowHandle: Send, Sync);
assert_not_impl_any!(WinRtWindowHandle: Send, Sync);
assert_impl_all!(WebWindowHandle: Send, Sync);
assert_not_impl_any!(WebWindowHandle: Send, Sync);
assert_not_impl_any!(WebCanvasWindowHandle: Send, Sync);
assert_not_impl_any!(WebOffscreenCanvasWindowHandle: Send, Sync);
assert_not_impl_any!(AndroidNdkWindowHandle: Send, Sync);
Expand Down
7 changes: 6 additions & 1 deletion src/web.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use core::ffi::c_void;
use core::marker::PhantomData;
use core::ptr::NonNull;

use super::DisplayHandle;
Expand Down Expand Up @@ -55,6 +56,7 @@ pub struct WebWindowHandle {
///
/// [data attributes]: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/data-*
pub id: u32,
_marker: PhantomData<*const ()>,
}

impl WebWindowHandle {
Expand All @@ -70,7 +72,10 @@ impl WebWindowHandle {
/// let handle = WebWindowHandle::new(id);
/// ```
pub fn new(id: u32) -> Self {
Self { id }
Self {
id,
_marker: PhantomData,
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/windows.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use core::ffi::c_void;
use core::marker::PhantomData;
use core::num::NonZeroIsize;
use core::ptr::NonNull;

Expand Down Expand Up @@ -54,6 +55,7 @@ pub struct Win32WindowHandle {
pub hwnd: NonZeroIsize,
/// The `GWLP_HINSTANCE` associated with this type's `HWND`.
pub hinstance: Option<NonZeroIsize>,
_marker: PhantomData<*const ()>,
}

impl Win32WindowHandle {
Expand All @@ -80,6 +82,7 @@ impl Win32WindowHandle {
Self {
hwnd,
hinstance: None,
_marker: PhantomData,
}
}
}
Expand Down

0 comments on commit 191fffe

Please # to comment.