catlog_wasm/
lib.rs

1pub mod result;
2
3pub mod model;
4pub mod model_diagram;
5pub mod model_morphism;
6pub mod theory;
7
8pub mod analyses;
9#[allow(clippy::new_without_default)]
10pub mod theories;
11
12use wasm_bindgen::prelude::*;
13
14/** Produce type defs for dependencies supporting `serde` but not `tsify`.
15
16Somewhat amazingly, the type system in TypeScript can express the constraint
17that an array be nonempty, with certain usage caveats:
18
19https://stackoverflow.com/q/56006111
20
21For now, though, we will not attempt to enforce this in the TypeScript layer.
22 */
23#[wasm_bindgen(typescript_custom_section)]
24const TS_APPEND_CONTENT: &'static str = r#"
25export type Uuid = string;
26export type Ustr = string;
27
28export type NonEmpty<T> = Array<T>;
29"#;
30
31#[wasm_bindgen]
32pub fn set_panic_hook() {
33    // When the `console_error_panic_hook` feature is enabled, we can call the
34    // `set_panic_hook` function at least once during initialization, and then
35    // we will get better error messages if our code ever panics.
36    //
37    // For more details see
38    // https://github.com/rustwasm/console_error_panic_hook#readme
39    #[cfg(feature = "console_error_panic_hook")]
40    console_error_panic_hook::set_once();
41}