1use core::ffi::c_void;
2use core::ptr::NonNull;
3
4/// Raw display handle for AppKit.
5#[non_exhaustive]
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
7pub struct AppKitDisplayHandle {}
8
9impl AppKitDisplayHandle {
10 /// Create a new empty display handle.
11 ///
12 ///
13 /// # Example
14 ///
15 /// ```
16 /// # use raw_window_handle::AppKitDisplayHandle;
17 /// let handle = AppKitDisplayHandle::new();
18 /// ```
19 pub fn new() -> Self {
20 Self {}
21 }
22}
23
24/// Raw window handle for AppKit.
25#[non_exhaustive]
26#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
27pub struct AppKitWindowHandle {
28 /// A pointer to an `NSView` object.
29 pub ns_view: NonNull<c_void>,
30}
31
32impl AppKitWindowHandle {
33 /// Create a new handle to a view.
34 ///
35 ///
36 /// # Example
37 ///
38 /// ```
39 /// # use core::ptr::NonNull;
40 /// # use raw_window_handle::AppKitWindowHandle;
41 /// # type NSView = ();
42 /// #
43 /// let view: &NSView;
44 /// # view = &();
45 /// let handle = AppKitWindowHandle::new(NonNull::from(view).cast());
46 /// ```
47 pub fn new(ns_view: NonNull<c_void>) -> Self {
48 Self { ns_view }
49 }
50}
51