blob: 55475df4dba5dae3395a9c13493db9f862d14008 (
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 ICU4XList_box_destroy_registry = new FinalizationRegistry(underlying => {
wasm.ICU4XList_destroy(underlying);
});
export class ICU4XList {
#lifetimeEdges = [];
constructor(underlying, owned, edges) {
this.underlying = underlying;
this.#lifetimeEdges.push(...edges);
if (owned) {
ICU4XList_box_destroy_registry.register(this, underlying);
}
}
static create() {
return new ICU4XList(wasm.ICU4XList_create(), true, []);
}
static create_with_capacity(arg_capacity) {
return new ICU4XList(wasm.ICU4XList_create_with_capacity(arg_capacity), true, []);
}
push(arg_val) {
const buf_arg_val = diplomatRuntime.DiplomatBuf.str(wasm, arg_val);
wasm.ICU4XList_push(this.underlying, buf_arg_val.ptr, buf_arg_val.size);
buf_arg_val.free();
}
len() {
return wasm.ICU4XList_len(this.underlying);
}
}
|