Add wasm-bindgen.

This commit is contained in:
Tom Alexander 2023-12-24 00:59:41 -05:00
parent a48d76321e
commit b3f97dbb40
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 5 additions and 3 deletions

View File

@ -56,6 +56,7 @@ tracing = { version = "0.1.37", optional = true }
tracing-opentelemetry = { version = "0.20.0", optional = true }
tracing-subscriber = { version = "0.3.17", optional = true, features = ["env-filter"] }
walkdir = { version = "2.3.3", optional = true }
wasm-bindgen = { version = "0.2.89", optional = true }
[build-dependencies]
walkdir = "2.3.3"
@ -66,7 +67,7 @@ compare = ["tokio/process", "tokio/macros"]
foreign_document_test = ["compare", "dep:futures", "tokio/sync", "dep:walkdir", "tokio/process"]
tracing = ["dep:opentelemetry", "dep:opentelemetry-otlp", "dep:opentelemetry-semantic-conventions", "dep:tokio", "dep:tracing", "dep:tracing-opentelemetry", "dep:tracing-subscriber"]
event_count = []
wasm = ["dep:serde"]
wasm = ["dep:serde", "dep:wasm-bindgen"]
# Optimized build for any sort of release.
[profile.release-lto]

View File

@ -1,6 +1,7 @@
#![no_main]
use wasm_bindgen::prelude::wasm_bindgen;
#[no_mangle]
pub extern "C" fn add(left: usize, right: usize) -> usize {
#[wasm_bindgen]
pub fn add(left: usize, right: usize) -> usize {
left + right
}