-
Notifications
You must be signed in to change notification settings - Fork 0
/
lib.rs
62 lines (55 loc) · 1.5 KB
/
lib.rs
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#![recursion_limit = "1024"]
use std::panic;
use wasm_bindgen::prelude::*;
extern crate console_error_panic_hook;
extern crate pest;
extern crate web_logger;
#[macro_use]
extern crate log;
#[macro_use]
extern crate maplit;
#[macro_use]
extern crate stdweb;
#[macro_use]
extern crate pest_derive;
pub mod coordinate;
pub mod grammar;
pub mod grammar_map;
pub mod model;
pub mod session;
pub mod style;
pub mod util;
pub mod view;
pub mod codemirror;
use crate::model::Model;
/*
* DATA MODEL:
* is centered around the "grammars" map: HashMap<Coordinate, Grammar>
* this is a linear-time accessible directory of every grammar in the system
* as indexed by the grammar coordinate
*
*/
/*
* # Other Notes:
*
* Enums vs Structs:
* Structs are just a basic collection of fields like in a class.
* Enums are used to represent a value that can take multiple forms.
* For instance,
*
* `#[derive()]`:
* These is a macro provided in the Rust standard library for generating code
* to automatically implement certain traits (interfaces) in Rust
*
* NonZeroU32:
* In a number of places in the application, we make use of integers that can be neither
* negative (unsigned) nor zero, such as the coordinate values. We adapt the standard rust
* data type NonZeroU32 (non-zero unsigned 32-bit integer) as a type for such values
*/
#[wasm_bindgen]
pub fn run_app() -> Result<(), JsValue> {
web_logger::init();
panic::set_hook(Box::new(console_error_panic_hook::hook));
yew::start_app::<Model>();
Ok(())
}