From: Ian Jackson Date: Sat, 10 Oct 2020 16:09:17 +0000 (+0100) Subject: Initial wasm crate X-Git-Tag: otter-0.2.0~720 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=6a9e0a4823c1ba31ace9fa2e02b2f743537d4d94;p=otter.git Initial wasm crate Signed-off-by: Ian Jackson --- diff --git a/Cargo.lock.example b/Cargo.lock.example index 68c3ba55..ad78b5a6 100644 --- a/Cargo.lock.example +++ b/Cargo.lock.example @@ -186,6 +186,12 @@ dependencies = [ "byte-tools", ] +[[package]] +name = "bumpalo" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" + [[package]] name = "bundle-sources" version = "0.1.0" @@ -1117,6 +1123,14 @@ dependencies = [ "vecdeque-stableix", ] +[[package]] +name = "otter-wasm" +version = "0.0.1" +dependencies = [ + "otter-zcoord", + "wasm-bindgen", +] + [[package]] name = "otter-zcoord" version = "0.0.1" @@ -2184,6 +2198,60 @@ version = "0.10.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" +[[package]] +name = "wasm-bindgen" +version = "0.2.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68" +dependencies = [ + "bumpalo", + "lazy_static", + "log 0.4.11", + "proc-macro2 1.0.24", + "quote 1.0.7", + "syn 1.0.43", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" +dependencies = [ + "quote 1.0.7", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" +dependencies = [ + "proc-macro2 1.0.24", + "quote 1.0.7", + "syn 1.0.43", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" + [[package]] name = "winapi" version = "0.2.8" diff --git a/Cargo.toml b/Cargo.toml index 0ce65fa5..ba01bda7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ version = "0.0.1" edition = "2018" [workspace] +members = ["wasm"] [dependencies] #lazy_static = "1.0.0" diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml new file mode 100644 index 00000000..715c03c6 --- /dev/null +++ b/wasm/Cargo.toml @@ -0,0 +1,17 @@ + +[package] +name = "otter-wasm" +authors = ["Ian Jackson "] +license = "AGPL-3.0-or-later" + +version = "0.0.1" +edition = "2018" + +[lib] +name = "otter_wasm" +path = "wasm.rs" +crate-type = ["cdylib"] + +[dependencies] +otter-zcoord = { path = "../zcoord" } +wasm-bindgen = "0.2" diff --git a/wasm/wasm.rs b/wasm/wasm.rs new file mode 100644 index 00000000..d6c22dc9 --- /dev/null +++ b/wasm/wasm.rs @@ -0,0 +1,5 @@ + +use wasm_bindgen::prelude::*; + +#[wasm_bindgen] +pub struct ZCoordIterator (zcoord::Mutable);