Skip to content

Latest commit

聽

History

History
35 lines (25 loc) 路 896 Bytes

WASM.md

File metadata and controls

35 lines (25 loc) 路 896 Bytes

WASM Usage Guide: cum-rs

Building

wasm-pack build --target web --features wasm
# or via Trunk (see examples/unmark/):
cd examples/unmark && trunk serve

Browser Usage (vanilla JS)

<script type="module">
  import init, {
    clean_text_wasm,
    inspect_text_wasm,
    clean_bytes_wasm,
  } from "./pkg/cum_rs.js";

  await init();

  const result = JSON.parse(clean_text_wasm("Hello\u200b world\ufeff!"));
  console.log(result.cleaned); // "Hello world!"
  console.log(result.removed_count); // 2
</script>

Yew / Rust front-end

See the live example in examples/unmark/: a split-panel Yew 0.22 CSR app that accepts text or file upload on the left and shows the cleaned output on the right with Copy / Download buttons.

CORS

cum-rs operates entirely client-side (pure computation on input bytes). No network requests are made.