domus

One damus client to rule them all
git clone git://jb55.com/domus
Log | Files | Refs | README

main.rs (1200B)


      1 #![warn(clippy::all, rust_2018_idioms)]
      2 #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
      3 use damus::Damus;
      4 
      5 // Entry point for wasm
      6 //#[cfg(target_arch = "wasm32")]
      7 //use wasm_bindgen::prelude::*;
      8 
      9 // Desktop
     10 #[cfg(not(target_arch = "wasm32"))]
     11 #[tokio::main]
     12 async fn main() {
     13     // Log to stdout (if you run with `RUST_LOG=debug`).
     14     tracing_subscriber::fmt::init();
     15 
     16     let native_options = eframe::NativeOptions::default();
     17     eframe::run_native(
     18         "Damus Desktop",
     19         native_options,
     20         Box::new(|_cc| Box::new(Damus::new())),
     21     );
     22 }
     23 
     24 #[cfg(target_arch = "wasm32")]
     25 pub fn main() {
     26     // Make sure panics are logged using `console.error`.
     27     console_error_panic_hook::set_once();
     28 
     29     // Redirect tracing to console.log and friends:
     30     tracing_wasm::set_as_global_default();
     31 
     32     wasm_bindgen_futures::spawn_local(async {
     33         let web_options = eframe::WebOptions::default();
     34         eframe::start_web(
     35             "the_canvas_id", // hardcode it
     36             web_options,
     37             Box::new(|_cc| Box::new(Damus::new())),
     38         )
     39         .await
     40         .expect("failed to start eframe");
     41     });
     42 }
     43