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    rustdoc::broken_intra_doc_links,
22    unstable_features
23)]
24#![allow(non_snake_case)]
25
26extern crate alloc;
27
28mod client;
29mod table;
30mod table_data;
31pub mod utils;
32mod view;
33
34#[cfg(feature = "export-init")]
35use wasm_bindgen::prelude::*;
36
37pub use crate::client::Client;
38pub use crate::table::*;
39pub use crate::table_data::*;
40
41#[cfg(feature = "export-init")]
42#[wasm_bindgen(typescript_custom_section)]
43const TS_APPEND_CONTENT: &'static str = r#"
44export type * from "../../src/ts/ts-rs/ViewWindow.d.ts";
45export type * from "../../src/ts/ts-rs/ColumnWindow.d.ts";
46export type * from "../../src/ts/ts-rs/TableInitOptions.d.ts";
47export type * from "../../src/ts/ts-rs/ViewConfigUpdate.d.ts";
48export type * from "../../src/ts/ts-rs/ViewOnUpdateResp.d.ts";
49export type * from "../../src/ts/ts-rs/OnUpdateOptions.d.ts";
50export type * from "../../src/ts/ts-rs/UpdateOptions.d.ts";
51export type * from "../../src/ts/ts-rs/DeleteOptions.d.ts";
52export type * from "../../src/ts/ts-rs/SystemInfo.d.ts";
53
54import type {ColumnWindow} from "../../src/ts/ts-rs/ColumnWindow.d.ts";
55import type {ViewWindow} from "../../src/ts/ts-rs/ViewWindow.d.ts";
56import type {TableInitOptions} from "../../src/ts/ts-rs/TableInitOptions.d.ts";
57import type {ViewConfigUpdate} from "../../src/ts/ts-rs/ViewConfigUpdate.d.ts";
58import type * as on_update_args from "../../src/ts/ts-rs/ViewOnUpdateResp.d.ts";
59import type {OnUpdateOptions} from "../../src/ts/ts-rs/OnUpdateOptions.d.ts";
60import type {UpdateOptions} from "../../src/ts/ts-rs/UpdateOptions.d.ts";
61import type {DeleteOptions} from "../../src/ts/ts-rs/DeleteOptions.d.ts";
62import type {SystemInfo} from "../../src/ts/ts-rs/SystemInfo.d.ts";
63"#;
64
65#[cfg(feature = "export-init")]
66#[wasm_bindgen]
67pub fn init() {
68    console_error_panic_hook::set_once();
69    utils::set_global_logging();
70}