lib.rs
846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
mod api;
mod data;
mod error;
mod client;
mod component;
use cfg_if::cfg_if;
cfg_if! {
if #[cfg(feature = "wee_alloc")] {
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
}
}
#[cfg(feature = "console_error_panic_hook")]
use std::panic;
use crate::component::*;
use log::Level;
use mogwai::prelude::*;
use wasm_bindgen::prelude::*;
#[wasm_bindgen(start)]
pub async fn main() -> Result<(), JsValue> {
#[cfg(feature = "console_error_panic_hook")]
panic::set_hook(Box::new(console_error_panic_hook::hook));
console_log::init_with_level(Level::Trace).unwrap();
let md = markdown::new().await;
let comp = upload::new().await;
let page = Component::from(builder! {
<div>
{comp}
{md}
</div>
});
page.build()?.run()
}