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 Oct 13, 2023
1 parent f963828 commit 8c3fe94
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;

/// Raw display handle for the Web.
Expand Down Expand Up @@ -33,6 +34,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 @@ -48,7 +50,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 @@ -32,6 +33,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 @@ -58,6 +60,7 @@ impl Win32WindowHandle {
Self {
hwnd,
hinstance: None,
_marker: PhantomData,
}
}
}
Expand Down

0 comments on commit 8c3fe94

Please # to comment.