// generated by diplomat-tool import { LocaleFallbackPriority } from "./LocaleFallbackPriority.mjs" import wasm from "./diplomat-wasm.mjs"; import * as diplomatRuntime from "./diplomat-runtime.mjs"; /** Collection of configurations for the ICU4X fallback algorithm. * *See the [Rust documentation for `LocaleFallbackConfig`](https://docs.rs/icu/latest/icu/locale/fallback/struct.LocaleFallbackConfig.html) for more information. */ export class LocaleFallbackConfig { #priority; get priority() { return this.#priority; } set priority(value) { this.#priority = value; } constructor(structObj) { if (typeof structObj !== "object") { throw new Error("LocaleFallbackConfig's constructor takes an object of LocaleFallbackConfig's fields."); } if ("priority" in structObj) { this.#priority = structObj.priority; } else { throw new Error("Missing required field priority."); } } // Return this struct in FFI function friendly format. // Returns an array that can be expanded with spread syntax (...) _intoFFI( functionCleanupArena, appendArrayMap ) { return [this.#priority.ffiValue] } _writeToArrayBuffer( arrayBuffer, offset, functionCleanupArena, appendArrayMap ) { diplomatRuntime.writeToArrayBuffer(arrayBuffer, offset + 0, this.#priority.ffiValue, Int32Array); } // This struct contains borrowed fields, so this takes in a list of // "edges" corresponding to where each lifetime's data may have been borrowed from // and passes it down to individual fields containing the borrow. // This method does not attempt to handle any dependencies between lifetimes, the caller // should handle this when constructing edge arrays. static _fromFFI(internalConstructor, ptr) { if (internalConstructor !== diplomatRuntime.internalConstructor) { throw new Error("LocaleFallbackConfig._fromFFI is not meant to be called externally. Please use the default constructor."); } var structObj = {}; const priorityDeref = diplomatRuntime.enumDiscriminant(wasm, ptr); structObj.priority = new LocaleFallbackPriority(diplomatRuntime.internalConstructor, priorityDeref); return new LocaleFallbackConfig(structObj, internalConstructor); } }