Skip to content

Commit ab820cf

Browse files
committed
feat: Add owned window handle
This adds "WindowHandle" and "DisplayHandle" types as discussed in #188. These act similar to `Waker`'s in stdlib, as they are a wrapper around a trait object. Signed-off-by: John Nunley <dev@notgull.net>
1 parent a4a5535 commit ab820cf

3 files changed

Lines changed: 580 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
## Unreleased
44

5-
* **Breaking:** Rework web handles to remove `wasm-bindgen` from public API. (#184)
5+
- **Breaking:** Rework web handles to remove `wasm-bindgen` from public API. (#184)
66
- **Breaking:** Remove `WebWindowHandle` as it is no longer used. (#186)
77
- **Breaking:** Remove deprecated `HasRawWindowHandle` and `HasRawDisplayHandle` traits.
88
- **Breaking:** Remove `UiKitWindowHandle::ui_view_controller` field, retrieve this from the UIView's responder chain instead.
99
- **Breaking:** Rename `Web*` handles to `WasmBindgen*`, to make it clearer that these are specific to `wasm-bindgen`.
10-
* Improve documentation on AppKit and UIKit handles.
1110
- Enabled `std` feature by default.
11+
- Add owned window and display handles.
12+
- Improve documentation on AppKit and UIKit handles.
1213

1314
## 0.6.2 (2024-05-17)
1415

src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ mod drm;
4747
mod gbm;
4848
mod haiku;
4949
mod ohos;
50+
mod owned;
5051
mod redox;
5152
mod uikit;
5253
mod wayland;
@@ -61,6 +62,10 @@ pub use drm::{DrmDisplayHandle, DrmWindowHandle};
6162
pub use gbm::{GbmDisplayHandle, GbmWindowHandle};
6263
pub use haiku::{HaikuDisplayHandle, HaikuWindowHandle};
6364
pub use ohos::{OhosDisplayHandle, OhosNdkWindowHandle};
65+
pub use owned::{
66+
DisplayHandleVtable, OwnedDisplayHandle, OwnedWindowHandle, SyncDisplayHandle,
67+
SyncWindowHandle, WindowHandleVtable,
68+
};
6469
pub use redox::{OrbitalDisplayHandle, OrbitalWindowHandle};
6570
pub use uikit::{UiKitDisplayHandle, UiKitWindowHandle};
6671
pub use wayland::{WaylandDisplayHandle, WaylandWindowHandle};
@@ -454,6 +459,13 @@ mod tests {
454459
assert_not_impl_any!(WasmBindgenOffscreenCanvasWindowHandle: Send, Sync);
455460
assert_impl_all!(AndroidNdkWindowHandle: Send, Sync);
456461
assert_impl_all!(HaikuWindowHandle: Send, Sync);
462+
463+
assert_impl_all!(OwnedDisplayHandle: Unpin, UnwindSafe, RefUnwindSafe);
464+
assert_not_impl_any!(OwnedDisplayHandle: Send, Sync);
465+
assert_impl_all!(SyncDisplayHandle: Unpin, UnwindSafe, RefUnwindSafe, Sync, Send);
466+
assert_impl_all!(OwnedWindowHandle: Unpin, UnwindSafe, RefUnwindSafe);
467+
assert_not_impl_any!(OwnedWindowHandle: Send, Sync);
468+
assert_impl_all!(SyncWindowHandle: Unpin, UnwindSafe, RefUnwindSafe, Sync, Send);
457469
}
458470

459471
#[allow(unused)]

0 commit comments

Comments
 (0)