Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
robertbastian committed Nov 23, 2023
1 parent 3271d40 commit ea0dcc4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions example/js/lib/api/diplomat-runtime.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions feature_tests/js/api/diplomat-runtime.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tool/src/js/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pub fn gen_value_js_to_rust<'env>(
match encoding {
ast::StringEncoding::UnvalidatedUtf8 => "str8",
ast::StringEncoding::UnvalidatedUtf16 => "str16",
_ => unreachable!("unknown AST/HIR variant"),
_ => unreachable!("unknown AST/HIR variant"),
}
));
} else {
Expand Down
12 changes: 6 additions & 6 deletions tool/src/js/runtime.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ export class DiplomatBuf {
rustType == "i8" ? new Int8Array(wasm.memory.buffer, ptr, byteLength) :
rustType == "u16" ? new Uint16Array(wasm.memory.buffer, ptr, byteLength) :
rustType == "i16" ? new Int16Array(wasm.memory.buffer, ptr, byteLength) :
rustType == "u32" || rustType == "usize" || rustType == "char" ? new Uint32Array(wasm.memory.buffer, ptr, byteLength) :
rustType == "i32" || rustType == "isize" ? new Int32Array(wasm.memory.buffer, ptr, byteLength) :
rustType == "u64" ? new BigUint64Array(wasm.memory.buffer, ptr, byteLength) :
rustType == "i64" ? new BigInt64Array(wasm.memory.buffer, ptr, byteLength) :
rustType == "f32" ? new Float32Array(wasm.memory.buffer, ptr, byteLength) :
Float64Array(wasm.memory.buffer, ptr, byteLength);
rustType == "i32" || rustType == "isize" ? new Int32Array(wasm.memory.buffer, ptr, byteLength) :
rustType == "u64" ? new BigUint64Array(wasm.memory.buffer, ptr, byteLength) :
rustType == "i64" ? new BigInt64Array(wasm.memory.buffer, ptr, byteLength) :
rustType == "f32" ? new Float32Array(wasm.memory.buffer, ptr, byteLength) :
rustType == "f64" ? new Float64Array(wasm.memory.buffer, ptr, byteLength) :
new Uint32Array(wasm.memory.buffer, ptr, byteLength);
destination.set(list);

return new DiplomatBuf(ptr, list.length, () => wasm.diplomat_free(ptr, byteLength, elementSize));
Expand Down

0 comments on commit ea0dcc4

Please sign in to comment.