forked from rust-windowing/raw-window-handle
/
android.rs
40 lines (37 loc) · 1.08 KB
/
android.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use core::ptr;
use libc::c_void;
/// Raw window handle for Android.
///
/// ## Construction
/// ```
/// # use raw_window_handle::android::AndroidHandle;
/// let handle = AndroidHandle {
/// /* fields */
/// ..AndroidHandle::empty()
/// };
/// ```
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct AndroidHandle {
/// A pointer to an ANativeWindow.
pub a_native_window: *mut c_void,
#[doc(hidden)]
#[deprecated = "This field is used to ensure that this struct is non-exhaustive, so that it may be extended in the future. Do not refer to this field."]
pub _non_exhaustive_do_not_use: crate::seal::Seal,
}
impl AndroidHandle {
pub fn empty() -> AndroidHandle {
#[allow(deprecated)]
AndroidHandle {
a_native_window: ptr::null_mut(),
_non_exhaustive_do_not_use: crate::seal::Seal,
}
}
}
impl From<new::AndroidNdkHandle> for AndroidHandle {
fn from(handle: new::AndroidNdkHandle) -> Self {
Self {
a_native_window: handle.a_native_window,
..Self::empty()
}
}
}