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/TableInitOptions.d.ts";
46export type * from "../../src/ts/ts-rs/ViewConfigUpdate.d.ts";
47export type * from "../../src/ts/ts-rs/ViewOnUpdateResp.d.ts";
48export type * from "../../src/ts/ts-rs/OnUpdateOptions.d.ts";
49export type * from "../../src/ts/ts-rs/UpdateOptions.d.ts";
50export type * from "../../src/ts/ts-rs/DeleteOptions.d.ts";
51
52import type {ViewWindow} from "../../src/ts/ts-rs/ViewWindow.d.ts";
53import type {TableInitOptions} from "../../src/ts/ts-rs/TableInitOptions.d.ts";
54import type {ViewConfigUpdate} from "../../src/ts/ts-rs/ViewConfigUpdate.d.ts";
55import type * as on_update_args from "../../src/ts/ts-rs/ViewOnUpdateResp.d.ts";
56import type {OnUpdateOptions} from "../../src/ts/ts-rs/OnUpdateOptions.d.ts";
57import type {UpdateOptions} from "../../src/ts/ts-rs/UpdateOptions.d.ts";
58import type {DeleteOptions} from "../../src/ts/ts-rs/DeleteOptions.d.ts";
59"#;
60
61#[cfg(feature = "export-init")]
62#[wasm_bindgen]
63pub fn init() {
64    console_error_panic_hook::set_once();
65    utils::set_global_logging();
66}