| 1 |
import wasm from "./diplomat-wasm.mjs" |
| 2 |
import * as diplomatRuntime from "./diplomat-runtime.mjs" |
| 3 |
import { ICU4XError_js_to_rust, ICU4XError_rust_to_js } from "./ICU4XError.mjs" |
| 4 |
|
| 5 |
const ICU4XGeneralCategoryNameToMaskMapper_box_destroy_registry = new FinalizationRegistry(underlying => { |
| 6 |
wasm.ICU4XGeneralCategoryNameToMaskMapper_destroy(underlying); |
| 7 |
}); |
| 8 |
|
| 9 |
export class ICU4XGeneralCategoryNameToMaskMapper { |
| 10 |
#lifetimeEdges = []; |
| 11 |
constructor(underlying, owned, edges) { |
| 12 |
this.underlying = underlying; |
| 13 |
this.#lifetimeEdges.push(...edges); |
| 14 |
if (owned) { |
| 15 |
ICU4XGeneralCategoryNameToMaskMapper_box_destroy_registry.register(this, underlying); |
| 16 |
} |
| 17 |
} |
| 18 |
|
| 19 |
get_strict(arg_name) { |
| 20 |
const buf_arg_name = diplomatRuntime.DiplomatBuf.str8(wasm, arg_name); |
| 21 |
const diplomat_out = wasm.ICU4XGeneralCategoryNameToMaskMapper_get_strict(this.underlying, buf_arg_name.ptr, buf_arg_name.size); |
| 22 |
buf_arg_name.free(); |
| 23 |
return diplomat_out; |
| 24 |
} |
| 25 |
|
| 26 |
get_loose(arg_name) { |
| 27 |
const buf_arg_name = diplomatRuntime.DiplomatBuf.str8(wasm, arg_name); |
| 28 |
const diplomat_out = wasm.ICU4XGeneralCategoryNameToMaskMapper_get_loose(this.underlying, buf_arg_name.ptr, buf_arg_name.size); |
| 29 |
buf_arg_name.free(); |
| 30 |
return diplomat_out; |
| 31 |
} |
| 32 |
|
| 33 |
static load(arg_provider) { |
| 34 |
return (() => { |
| 35 |
const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4); |
| 36 |
wasm.ICU4XGeneralCategoryNameToMaskMapper_load(diplomat_receive_buffer, arg_provider.underlying); |
| 37 |
const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4); |
| 38 |
if (is_ok) { |
| 39 |
const ok_value = new ICU4XGeneralCategoryNameToMaskMapper(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []); |
| 40 |
wasm.diplomat_free(diplomat_receive_buffer, 5, 4); |
| 41 |
return ok_value; |
| 42 |
} else { |
| 43 |
const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)]; |
| 44 |
wasm.diplomat_free(diplomat_receive_buffer, 5, 4); |
| 45 |
throw new diplomatRuntime.FFIError(throw_value); |
| 46 |
} |
| 47 |
})(); |
| 48 |
} |
| 49 |
} |