main.rs (1040B)
1 #![warn(clippy::all, rust_2018_idioms)] 2 #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release 3 4 // When compiling natively: 5 #[cfg(not(target_arch = "wasm32"))] 6 fn main() { 7 // Log to stdout (if you run with `RUST_LOG=debug`). 8 tracing_subscriber::fmt::init(); 9 10 let native_options = eframe::NativeOptions::default(); 11 eframe::run_native( 12 "Damus Desktop", 13 native_options, 14 Box::new(|cc| Box::new(damus::Damus::new(cc))), 15 ); 16 } 17 18 // when compiling to web using trunk. 19 #[cfg(target_arch = "wasm32")] 20 fn main() { 21 // Make sure panics are logged using `console.error`. 22 console_error_panic_hook::set_once(); 23 24 // Redirect tracing to console.log and friends: 25 tracing_wasm::set_as_global_default(); 26 27 let web_options = eframe::WebOptions::default(); 28 eframe::start_web( 29 "the_canvas_id", // hardcode it 30 web_options, 31 Box::new(|cc| Box::new(damus::Damus::new(cc))), 32 ) 33 .expect("failed to start eframe"); 34 }