// generated by diplomat-tool import { CodePointSetData } from "./CodePointSetData.mjs" import { ScriptExtensionsSet } from "./ScriptExtensionsSet.mjs" import wasm from "./diplomat-wasm.mjs"; import * as diplomatRuntime from "./diplomat-runtime.mjs"; /** A slightly faster ScriptWithExtensions object * *See the [Rust documentation for `ScriptWithExtensionsBorrowed`](https://docs.rs/icu/latest/icu/properties/script/struct.ScriptWithExtensionsBorrowed.html) for more information. */ const ScriptWithExtensionsBorrowed_box_destroy_registry = new FinalizationRegistry((ptr) => { wasm.icu4x_ScriptWithExtensionsBorrowed_destroy_mv1(ptr); }); export class ScriptWithExtensionsBorrowed { // Internal ptr reference: #ptr = null; // Lifetimes are only to keep dependencies alive. // Since JS won't garbage collect until there are no incoming edges. #selfEdge = []; #aEdge = []; constructor(symbol, ptr, selfEdge, aEdge) { if (symbol !== diplomatRuntime.internalConstructor) { console.error("ScriptWithExtensionsBorrowed is an Opaque type. You cannot call its constructor."); return; } this.#aEdge = aEdge; this.#ptr = ptr; this.#selfEdge = selfEdge; // Are we being borrowed? If not, we can register. if (this.#selfEdge.length === 0) { ScriptWithExtensionsBorrowed_box_destroy_registry.register(this, this.#ptr); } } get ffiValue() { return this.#ptr; } getScriptVal(ch) { const result = wasm.icu4x_ScriptWithExtensionsBorrowed_get_script_val_mv1(this.ffiValue, ch); try { return result; } finally {} } getScriptExtensionsVal(ch) { // This lifetime edge depends on lifetimes 'a let aEdges = [this]; const result = wasm.icu4x_ScriptWithExtensionsBorrowed_get_script_extensions_val_mv1(this.ffiValue, ch); try { return new ScriptExtensionsSet(diplomatRuntime.internalConstructor, result, [], aEdges); } finally {} } hasScript(ch, script) { const result = wasm.icu4x_ScriptWithExtensionsBorrowed_has_script_mv1(this.ffiValue, ch, script); try { return result; } finally {} } getScriptExtensionsSet(script) { const result = wasm.icu4x_ScriptWithExtensionsBorrowed_get_script_extensions_set_mv1(this.ffiValue, script); try { return new CodePointSetData(diplomatRuntime.internalConstructor, result, []); } finally {} } }