blob: 46ad3060c1a9db93858fdcd5e78c946a6b8dd148 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
import wasm from "./diplomat-wasm.mjs"
import * as diplomatRuntime from "./diplomat-runtime.js"
const ICU4XReorderedIndexMap_box_destroy_registry = new FinalizationRegistry(underlying => {
wasm.ICU4XReorderedIndexMap_destroy(underlying);
});
export class ICU4XReorderedIndexMap {
#lifetimeEdges = [];
constructor(underlying, owned, edges) {
this.underlying = underlying;
this.#lifetimeEdges.push(...edges);
if (owned) {
ICU4XReorderedIndexMap_box_destroy_registry.register(this, underlying);
}
}
as_slice() {
return (() => {
const diplomat_receive_buffer = wasm.diplomat_alloc(8, 4);
wasm.ICU4XReorderedIndexMap_as_slice(diplomat_receive_buffer, this.underlying);
const [ptr, size] = new Uint32Array(wasm.memory.buffer, diplomat_receive_buffer, 2);
wasm.diplomat_free(diplomat_receive_buffer, 8, 4);
return new Uint32Array(wasm.memory.buffer, ptr, size);
})();
}
len() {
return wasm.ICU4XReorderedIndexMap_len(this.underlying);
}
get(arg_index) {
return wasm.ICU4XReorderedIndexMap_get(this.underlying, arg_index);
}
}
|