zng/view_process.rs
1//! View process implementations.
2//!
3//! This module provides the [`default`] view-process implementation and a [`prebuilt`] version of it.
4//!
5//! ```no_run
6//! use zng::prelude::*;
7//! use zng::view_process::default as view_process;
8//! // use zng::view_process::prebuilt as view_process;
9//!
10//! fn main() {
11//! zng::env::init!();
12//! // single_process();
13//! // multi_process();
14//! }
15//!
16//! fn multi_process() {
17//! app();
18//! }
19//!
20//! fn single_process() {
21//! view_process::run_same_process(app);
22//! }
23//!
24//! fn app() {
25//! APP.defaults().run_window(async {
26//! Window! {
27//! }
28//! })
29//! }
30//! ```
31//!
32//! See the [`app`](crate::app) module documentation for more details about view-processes.
33//!
34//! See [`zng::env::init!`] for more details about running Android apps.
35
36/// Default view-process implementation.
37///
38/// # Full API
39///
40/// See [`zng_view`] for the full API including view API extensions such as enabling ANGLE backend on Windows.
41#[cfg(view)]
42pub mod default {
43 pub use zng_view::run_same_process;
44
45 /// Android init types.
46 ///
47 /// See [`winit::platform::android`](https://docs.rs/winit/latest/winit/platform/android/) for more details
48 /// on how to select a backend "Activity".
49 ///
50 /// See [`zng::env::init!`] for more details about running Android apps.
51 ///
52 /// # Full API
53 ///
54 /// See [`zng_view::platform::android`] for the full API.
55 #[cfg(target_os = "android")]
56 pub mod android {
57 pub use zng_view::platform::android::{activity::AndroidApp, init_android_app};
58 }
59}
60
61/// Default view-process implementation as an embedded precompiled binary.
62///
63/// # Full API
64///
65/// See [`zng_view_prebuilt`] and [`zng_view`] for the full API.
66#[cfg(view_prebuilt)]
67pub mod prebuilt {
68 pub use zng_view_prebuilt::run_same_process;
69}