1 | // Copyright © SixtyFPS GmbH <info@slint.dev> |
---|---|
2 | // SPDX-License-Identifier: MIT |
3 | |
4 | #![cfg_attr(feature = "mcu-board-support", no_std)] |
5 | #![cfg_attr(all(feature = "mcu-board-support", not(feature = "simulator")), no_main)] |
6 | |
7 | #[cfg(feature = "mcu-board-support")] |
8 | extern crate alloc; |
9 | |
10 | #[cfg(target_arch = "wasm32")] |
11 | use wasm_bindgen::prelude::*; |
12 | |
13 | slint::include_modules!(); |
14 | |
15 | #[cfg(not(feature = "mcu-board-support"))] |
16 | #[cfg_attr(target_arch = "wasm32", wasm_bindgen(start))] |
17 | pub fn main() { |
18 | // This provides better error messages in debug mode. |
19 | // It's disabled in release mode so it doesn't bloat up the file size. |
20 | #[cfg(all(debug_assertions, target_arch = "wasm32"))] |
21 | console_error_panic_hook::set_once(); |
22 | |
23 | MainWindow::new().unwrap().run().unwrap(); |
24 | } |
25 | |
26 | #[cfg(any(feature = "mcu-board-support", feature = "simulator"))] |
27 | #[mcu_board_support::entry] |
28 | fn main() -> ! { |
29 | mcu_board_support::init(); |
30 | MainWindow::new().unwrap().run().unwrap(); |
31 | |
32 | panic!("The MCU demo should not quit") |
33 | } |
34 |
Definitions
Learn Rust with the experts
Find out more