| 1 |
import wasm from "./diplomat-wasm.mjs" |
| 2 |
import * as diplomatRuntime from "./diplomat-runtime.mjs" |
| 3 |
import { CodePointRangeIterator } from "./CodePointRangeIterator.mjs" |
| 4 |
import { ICU4XCodePointSetData } from "./ICU4XCodePointSetData.mjs" |
| 5 |
import { ICU4XError_js_to_rust, ICU4XError_rust_to_js } from "./ICU4XError.mjs" |
| 6 |
|
| 7 |
const ICU4XCodePointMapData16_box_destroy_registry = new FinalizationRegistry(underlying => { |
| 8 |
wasm.ICU4XCodePointMapData16_destroy(underlying); |
| 9 |
}); |
| 10 |
|
| 11 |
export class ICU4XCodePointMapData16 { |
| 12 |
#lifetimeEdges = []; |
| 13 |
constructor(underlying, owned, edges) { |
| 14 |
this.underlying = underlying; |
| 15 |
this.#lifetimeEdges.push(...edges); |
| 16 |
if (owned) { |
| 17 |
ICU4XCodePointMapData16_box_destroy_registry.register(this, underlying); |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
get(arg_cp) { |
| 22 |
return wasm.ICU4XCodePointMapData16_get(this.underlying, diplomatRuntime.extractCodePoint(arg_cp, 'arg_cp')); |
| 23 |
} |
| 24 |
|
| 25 |
get32(arg_cp) { |
| 26 |
return wasm.ICU4XCodePointMapData16_get32(this.underlying, arg_cp); |
| 27 |
} |
| 28 |
|
| 29 |
iter_ranges_for_value(arg_value) { |
| 30 |
return new CodePointRangeIterator(wasm.ICU4XCodePointMapData16_iter_ranges_for_value(this.underlying, arg_value), true, [this]); |
| 31 |
} |
| 32 |
|
| 33 |
iter_ranges_for_value_complemented(arg_value) { |
| 34 |
return new CodePointRangeIterator(wasm.ICU4XCodePointMapData16_iter_ranges_for_value_complemented(this.underlying, arg_value), true, [this]); |
| 35 |
} |
| 36 |
|
| 37 |
get_set_for_value(arg_value) { |
| 38 |
return new ICU4XCodePointSetData(wasm.ICU4XCodePointMapData16_get_set_for_value(this.underlying, arg_value), true, []); |
| 39 |
} |
| 40 |
|
| 41 |
static load_script(arg_provider) { |
| 42 |
return (() => { |
| 43 |
const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4); |
| 44 |
wasm.ICU4XCodePointMapData16_load_script(diplomat_receive_buffer, arg_provider.underlying); |
| 45 |
const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4); |
| 46 |
if (is_ok) { |
| 47 |
const ok_value = new ICU4XCodePointMapData16(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []); |
| 48 |
wasm.diplomat_free(diplomat_receive_buffer, 5, 4); |
| 49 |
return ok_value; |
| 50 |
} else { |
| 51 |
const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)]; |
| 52 |
wasm.diplomat_free(diplomat_receive_buffer, 5, 4); |
| 53 |
throw new diplomatRuntime.FFIError(throw_value); |
| 54 |
} |
| 55 |
})(); |
| 56 |
} |
| 57 |
} |