crossbind
GitHub

Collections and bytes

Rust collections cross as plain JavaScript values: a Vec is an array, a map with string keys is an object, and bytes are a Uint8Array.

sorted takes an array and returns one, and word_lengths returns a BTreeMap, which arrives as an object keyed by its strings. Each is a deep copy: JavaScript and Rust share no collection.

invert reads its &[u8] from a Uint8Array and returns a Vec<u8>, which arrives as a new Uint8Array. &[f64] and Vec<f64> cross the same way, as a Float64Array.

Try it
Sort another list, then invert the inverted bytes to get the first array back.
Runs without a compile until the C++, Rust, packages or imports change.
Press Run, or Ctrl+Enter, to run main.js.
Type to search every guide page and section.
↑↓ navigate↵ openesc close