Skip to main content

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#[cfg(target_arch = "wasm32")]
34mod virtual_server;
35
36#[cfg(feature = "export-init")]
37use wasm_bindgen::prelude::*;
38
39pub use crate::client::Client;
40pub use crate::table::*;
41pub use crate::table_data::*;
42#[cfg(target_arch = "wasm32")]
43pub use crate::virtual_server::*;
44
45#[cfg(feature = "export-init")]
46#[wasm_bindgen(typescript_custom_section)]
47const TS_APPEND_CONTENT: &'static str = r#"
48export type * from "../../src/ts/ts-rs/ViewWindow.d.ts";
49export type * from "../../src/ts/ts-rs/ColumnType.d.ts";
50export type * from "../../src/ts/ts-rs/ColumnWindow.d.ts";
51export type * from "../../src/ts/ts-rs/TableInitOptions.d.ts";
52export type * from "../../src/ts/ts-rs/ViewConfigUpdate.d.ts";
53export type * from "../../src/ts/ts-rs/ViewOnUpdateResp.d.ts";
54export type * from "../../src/ts/ts-rs/OnUpdateOptions.d.ts";
55export type * from "../../src/ts/ts-rs/UpdateOptions.d.ts";
56export type * from "../../src/ts/ts-rs/DeleteOptions.d.ts";
57export type * from "../../src/ts/ts-rs/Scalar.d.ts";
58export type * from "../../src/ts/ts-rs/SystemInfo.d.ts";
59export type * from "../../src/ts/ts-rs/SortDir.d.ts";
60export type * from "../../src/ts/ts-rs/Filter.d.ts";
61export type * from "../../src/ts/ts-rs/ViewConfig.d.ts";
62
63import type {ColumnWindow} from "../../src/ts/ts-rs/ColumnWindow.d.ts";
64import type {ColumnType} from "../../src/ts/ts-rs/ColumnType.d.ts";
65import type {ViewWindow} from "../../src/ts/ts-rs/ViewWindow.d.ts";
66import type {TableInitOptions} from "../../src/ts/ts-rs/TableInitOptions.d.ts";
67import type {ViewConfigUpdate} from "../../src/ts/ts-rs/ViewConfigUpdate.d.ts";
68import type * as on_update_args from "../../src/ts/ts-rs/ViewOnUpdateResp.d.ts";
69import type {OnUpdateOptions} from "../../src/ts/ts-rs/OnUpdateOptions.d.ts";
70import type {UpdateOptions} from "../../src/ts/ts-rs/UpdateOptions.d.ts";
71import type {DeleteOptions} from "../../src/ts/ts-rs/DeleteOptions.d.ts";
72import type {SystemInfo} from "../../src/ts/ts-rs/SystemInfo.d.ts";
73"#;
74
75#[cfg(feature = "export-init")]
76#[wasm_bindgen]
77pub fn init() {
78    // console_error_panic_hook::set_once();
79    utils::set_global_logging();
80}