perspective_js/
lib.rs

1// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2// ┃ ██████ ██████ ██████       █      █      █      █      █ █▄  ▀███ █       ┃
3// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█  ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄  ▀█ █ ▀▀▀▀▀ ┃
4// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄   █ ▄▄▄▄▄ ┃
5// ┃ █      ██████ █  ▀█▄       █ ██████      █      ███▌▐███ ███████▄ █       ┃
6// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
7// ┃ Copyright (c) 2017, the Perspective Authors.                              ┃
8// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
9// ┃ This file is part of the Perspective library, distributed under the terms ┃
10// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
11// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
12
13//! <div class="warning">
14//! The examples in this module are in JavaScript. See <a href="https://docs.rs/crate/perspective/latest"><code>perspective</code></a> docs for the Rust API.
15//! </div>
16
17#![warn(
18    clippy::all,
19    clippy::panic_in_result_fn,
20    clippy::await_holding_refcell_ref,
21    unstable_features
22)]
23#![allow(non_snake_case)]
24
25extern crate alloc;
26
27mod client;
28mod table;
29mod table_data;
30pub mod utils;
31mod view;
32
33#[cfg(feature = "export-init")]
34use wasm_bindgen::prelude::*;
35
36pub use crate::client::Client;
37pub use crate::table::*;
38pub use crate::table_data::*;
39
40#[cfg(feature = "export-init")]
41#[wasm_bindgen(typescript_custom_section)]
42const TS_APPEND_CONTENT: &'static str = r#"
43export type * from "../../src/ts/ts-rs/ViewWindow.d.ts";
44export type * from "../../src/ts/ts-rs/TableInitOptions.d.ts";
45export type * from "../../src/ts/ts-rs/ViewConfigUpdate.d.ts";
46export type * from "../../src/ts/ts-rs/ViewOnUpdateResp.d.ts";
47export type * from "../../src/ts/ts-rs/OnUpdateOptions.d.ts";
48export type * from "../../src/ts/ts-rs/UpdateOptions.d.ts";
49export type * from "../../src/ts/ts-rs/DeleteOptions.d.ts";
50
51import type {ViewWindow} from "../../src/ts/ts-rs/ViewWindow.d.ts";
52import type {TableInitOptions} from "../../src/ts/ts-rs/TableInitOptions.d.ts";
53import type {ViewConfigUpdate} from "../../src/ts/ts-rs/ViewConfigUpdate.d.ts";
54import type * as on_update_args from "../../src/ts/ts-rs/ViewOnUpdateResp.d.ts";
55import type {OnUpdateOptions} from "../../src/ts/ts-rs/OnUpdateOptions.d.ts";
56import type {UpdateOptions} from "../../src/ts/ts-rs/UpdateOptions.d.ts";
57import type {DeleteOptions} from "../../src/ts/ts-rs/DeleteOptions.d.ts";
58"#;
59
60#[cfg(feature = "export-init")]
61#[wasm_bindgen]
62pub fn init() {
63    console_error_panic_hook::set_once();
64    utils::set_global_logging();
65}