diff --git a/Rust/wasmpi/web/dist/package.json b/Rust/wasmpi/web/dist/package.json new file mode 100644 index 0000000000000000000000000000000000000000..12bfb038b28abfe3e69160b6e03ae17c4432ee5a --- /dev/null +++ b/Rust/wasmpi/web/dist/package.json @@ -0,0 +1,15 @@ +{ + "name": "wasmpi", + "type": "module", + "version": "0.1.0", + "files": [ + "wasmpi_bg.wasm", + "wasmpi.js", + "wasmpi.d.ts" + ], + "main": "wasmpi.js", + "types": "wasmpi.d.ts", + "sideEffects": [ + "./snippets/*" + ] +} \ No newline at end of file diff --git a/Rust/wasmpi/web/dist/wasmpi.d.ts b/Rust/wasmpi/web/dist/wasmpi.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..59be2b886b22fbb2b276b911e427ff4f1d69caa5 --- /dev/null +++ b/Rust/wasmpi/web/dist/wasmpi.d.ts @@ -0,0 +1,35 @@ +/* tslint:disable */ +/* eslint-disable */ +export function rust_serial_pi(npts: number): number; +export function rust_serial_map_pi(npts: number): number; + +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; + +export interface InitOutput { + readonly memory: WebAssembly.Memory; + readonly rust_serial_pi: (a: number) => number; + readonly rust_serial_map_pi: (a: number) => number; + readonly __wbindgen_export_0: WebAssembly.Table; + readonly __wbindgen_start: () => void; +} + +export type SyncInitInput = BufferSource | WebAssembly.Module; +/** +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated. +* +* @returns {InitOutput} +*/ +export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput; + +/** +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and +* for everything else, calls `WebAssembly.instantiate` directly. +* +* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated. +* +* @returns {Promise<InitOutput>} +*/ +export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>; diff --git a/Rust/wasmpi/web/dist/wasmpi.js b/Rust/wasmpi/web/dist/wasmpi.js new file mode 100644 index 0000000000000000000000000000000000000000..3fffffa4835ae8937239744d8b1f7a86d4c3ed27 --- /dev/null +++ b/Rust/wasmpi/web/dist/wasmpi.js @@ -0,0 +1,136 @@ +let wasm; + +/** + * @param {number} npts + * @returns {number} + */ +export function rust_serial_pi(npts) { + const ret = wasm.rust_serial_pi(npts); + return ret; +} + +/** + * @param {number} npts + * @returns {number} + */ +export function rust_serial_map_pi(npts) { + const ret = wasm.rust_serial_map_pi(npts); + return ret; +} + +async function __wbg_load(module, imports) { + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } + } + + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); + + } else { + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } + } +} + +function __wbg_get_imports() { + const imports = {}; + imports.wbg = {}; + imports.wbg.__wbindgen_init_externref_table = function() { + const table = wasm.__wbindgen_export_0; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + ; + }; + + return imports; +} + +function __wbg_init_memory(imports, memory) { + +} + +function __wbg_finalize_init(instance, module) { + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + + + wasm.__wbindgen_start(); + return wasm; +} + +function initSync(module) { + if (wasm !== undefined) return wasm; + + + if (typeof module !== 'undefined') { + if (Object.getPrototypeOf(module) === Object.prototype) { + ({module} = module) + } else { + console.warn('using deprecated parameters for `initSync()`; pass a single object instead') + } + } + + const imports = __wbg_get_imports(); + + __wbg_init_memory(imports); + + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); + } + + const instance = new WebAssembly.Instance(module, imports); + + return __wbg_finalize_init(instance, module); +} + +async function __wbg_init(module_or_path) { + if (wasm !== undefined) return wasm; + + + if (typeof module_or_path !== 'undefined') { + if (Object.getPrototypeOf(module_or_path) === Object.prototype) { + ({module_or_path} = module_or_path) + } else { + console.warn('using deprecated parameters for the initialization function; pass a single object instead') + } + } + + if (typeof module_or_path === 'undefined') { + module_or_path = new URL('wasmpi_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); + + if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) { + module_or_path = fetch(module_or_path); + } + + __wbg_init_memory(imports); + + const { instance, module } = await __wbg_load(await module_or_path, imports); + + return __wbg_finalize_init(instance, module); +} + +export { initSync }; +export default __wbg_init; diff --git a/Rust/wasmpi/web/dist/wasmpi_bg.wasm b/Rust/wasmpi/web/dist/wasmpi_bg.wasm new file mode 100644 index 0000000000000000000000000000000000000000..0747a4eade0b7998bae8411a246e39e25b5382f9 Binary files /dev/null and b/Rust/wasmpi/web/dist/wasmpi_bg.wasm differ diff --git a/Rust/wasmpi/web/dist/wasmpi_bg.wasm.d.ts b/Rust/wasmpi/web/dist/wasmpi_bg.wasm.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1969a3402878befe9273f93f7a3c429d907851db --- /dev/null +++ b/Rust/wasmpi/web/dist/wasmpi_bg.wasm.d.ts @@ -0,0 +1,7 @@ +/* tslint:disable */ +/* eslint-disable */ +export const memory: WebAssembly.Memory; +export const rust_serial_pi: (a: number) => number; +export const rust_serial_map_pi: (a: number) => number; +export const __wbindgen_export_0: WebAssembly.Table; +export const __wbindgen_start: () => void;