caliphui/
lib.rs

1#![forbid(unsafe_code)]
2#![cfg_attr(not(debug_assertions), deny(warnings))] // Forbid warnings in release builds
3#![warn(clippy::all, rust_2018_idioms)]
4
5mod app;
6pub use app::TemplateApp;
7
8// ----------------------------------------------------------------------------
9// When compiling for web:
10
11#[cfg(target_arch = "wasm32")]
12use eframe::wasm_bindgen::{self, prelude::*};
13
14/// This is the entry-point for all the web-assembly.
15/// This is called once from the HTML.
16/// It loads the app, installs some callbacks, then returns.
17/// You can add more callbacks like this if you want to call in to your code.
18#[cfg(target_arch = "wasm32")]
19#[wasm_bindgen]
20pub fn start(canvas_id: &str) -> Result<(), eframe::wasm_bindgen::JsValue> {
21    let app = TemplateApp::default();
22    eframe::start_web(canvas_id, Box::new(app))
23}