1 | /// Raw display handle for the Web. |
2 | /// |
3 | /// ## Construction |
4 | /// ``` |
5 | /// # use raw_window_handle::WebDisplayHandle; |
6 | /// let mut display_handle = WebDisplayHandle::empty(); |
7 | /// /* set fields */ |
8 | /// ``` |
9 | #[non_exhaustive ] |
10 | #[derive (Debug, Clone, Copy, PartialEq, Eq, Hash)] |
11 | pub struct WebDisplayHandle; |
12 | |
13 | impl WebDisplayHandle { |
14 | pub fn empty() -> Self { |
15 | Self {} |
16 | } |
17 | } |
18 | |
19 | /// Raw window handle for the Web. |
20 | /// |
21 | /// ## Construction |
22 | /// ``` |
23 | /// # use raw_window_handle::WebWindowHandle; |
24 | /// let mut window_handle = WebWindowHandle::empty(); |
25 | /// /* set fields */ |
26 | /// ``` |
27 | #[non_exhaustive ] |
28 | #[derive (Debug, Clone, Copy, PartialEq, Eq, Hash)] |
29 | pub struct WebWindowHandle { |
30 | /// An ID value inserted into the [data attributes] of the canvas element as '`raw-handle`'. |
31 | /// |
32 | /// When accessing from JS, the attribute will automatically be called `rawHandle`. |
33 | /// |
34 | /// Each canvas created by the windowing system should be assigned their own unique ID. |
35 | /// 0 should be reserved for invalid / null IDs. |
36 | /// |
37 | /// [data attributes]: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/data-* |
38 | pub id: u32, |
39 | } |
40 | |
41 | impl WebWindowHandle { |
42 | pub fn empty() -> Self { |
43 | Self { id: 0 } |
44 | } |
45 | } |
46 | |