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//! See the [`app`](crate::app) module documentation for more details about view-processes.
32//!
33//! See [`zng::env::init!`] for more details about running Android apps.
34//!
35//! See [`zng_view_api::Controller::start`] for details on how to relax connection timeouts in very slow test runner machines.
36
37/// Default view-process implementation.
38///
39/// # Full API
40///
41/// See [`zng_view`] for the full API including view API extensions such as enabling ANGLE backend on Windows.
42#[cfg(view)]
43pub mod default {
44    pub use zng_view::run_same_process;
45
46    /// Android init types.
47    ///
48    /// See [`winit::platform::android`](https://docs.rs/winit/latest/winit/platform/android/) for more details
49    /// on how to select a backend "Activity".
50    ///
51    /// See [`zng::env::init!`] for more details about running Android apps.
52    ///
53    /// # Full API
54    ///
55    /// See [`zng_view::platform::android`] for the full API.
56    #[cfg(target_os = "android")]
57    pub mod android {
58        pub use zng_view::platform::android::{activity::AndroidApp, init_android_app};
59    }
60}
61
62/// Default view-process implementation as an embedded precompiled binary.
63///
64/// # Full API
65///
66/// See [`zng_view_prebuilt`] and [`zng_view`] for the full API.
67#[cfg(view_prebuilt)]
68pub mod prebuilt {
69    pub use zng_view_prebuilt::run_same_process;
70}