Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  LocaleFallbackConfig.mjs   Sprache: unbekannt

 
Spracherkennung für: .mjs vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

// 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/2.1.1/icu/locale/fallback/struct.LocaleFallbackConfig.html) for more information.
 */
export class LocaleFallbackConfig {
    #priority;
    get priority() {
        return this.#priority;
    }
    set priority(value){
        this.#priority = value;
    }
    /** @internal */
    static fromFields(structObj) {
        return new LocaleFallbackConfig(structObj);
    }

    #internalConstructor(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;
    }

    // Return this struct in FFI function friendly format.
    // Returns an array that can be expanded with spread syntax (...)
    _intoFFI(
        functionCleanupArena,
        appendArrayMap
    ) {
        let buffer = diplomatRuntime.DiplomatBuf.struct(wasm, 44);

        this._writeToArrayBuffer(wasm.memory.buffer, buffer.ptr, functionCleanupArena, appendArrayMap);

        functionCleanupArena.alloc(buffer);

        return buffer.ptr;
    }

    static _fromSuppliedValue(internalConstructor, obj) {
        if (internalConstructor !== diplomatRuntime.internalConstructor) {
            throw new Error("_fromSuppliedValue cannot be called externally.");
        }

        if (obj instanceof LocaleFallbackConfig) {
            return obj;
        }

        return LocaleFallbackConfig.fromFields(obj);
    }

    _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.");
        }
        let structObj = {};
        const priorityDeref = diplomatRuntime.enumDiscriminant(wasm, ptr);
        structObj.priority = new LocaleFallbackPriority(diplomatRuntime.internalConstructor, priorityDeref);

        return new LocaleFallbackConfig(structObj);
    }


    constructor(structObj) {
        return this.#internalConstructor(...arguments)
    }
}

[Dauer der Verarbeitung: 0.45 Sekunden]

                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=752002