Eine aufbereitete Darstellung der Quelle

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

Benutzer

Quelle  VariantOffsets.mjs   Sprache: unbekannt

 
Untersuchungsergebnis.mjs Download desUnknown {[0] [0] [0]}

// generated by diplomat-tool
import { UtcOffset } from "./UtcOffset.mjs"
import wasm from "./diplomat-wasm.mjs";
import * as diplomatRuntime from "./diplomat-runtime.mjs";



/**
 * See the [Rust documentation for `VariantOffsets`](https://docs.rs/icu/2.1.1/icu/time/zone/struct.VariantOffsets.html) for more information.
 */
export class VariantOffsets {
    #standard;
    get standard() {
        return this.#standard;
    }
    #daylight;
    get daylight() {
        return this.#daylight;
    }
    #internalConstructor(structObj, internalConstructor) {
        if (typeof structObj !== "object") {
            throw new Error("VariantOffsets's constructor takes an object of VariantOffsets's fields.");
        }

        if (internalConstructor !== diplomatRuntime.internalConstructor) {
            throw new Error("VariantOffsets is an out struct and can only be created internally.");
        }
        if ("standard" in structObj) {
            this.#standard = structObj.standard;
        } else {
            throw new Error("Missing required field standard.");
        }

        if ("daylight" in structObj) {
            this.#daylight = structObj.daylight;
        } else {
            throw new Error("Missing required field daylight.");
        }

        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, 84);

        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 VariantOffsets) {
            return obj;
        }

        return VariantOffsets.fromFields(obj);
    }

    _writeToArrayBuffer(
        arrayBuffer,
        offset,
        functionCleanupArena,
        appendArrayMap
    ) {
        diplomatRuntime.writeToArrayBuffer(arrayBuffer, offset + 0, this.#standard.ffiValue, Uint32Array);
        diplomatRuntime.writeToArrayBuffer(arrayBuffer, offset + 4, this.#daylight.ffiValue ?0, Uint32Array);
    }

    // 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("VariantOffsets._fromFFI is not meant to be called externally. Please use the default constructor.");
        }
        let structObj = {};
        const standardDeref = diplomatRuntime.ptrRead(wasm, ptr);
        structObj.standard = new UtcOffset(diplomatRuntime.internalConstructor, standardDeref, []);
        const daylightDeref = diplomatRuntime.ptrRead(wasm, ptr + 4);
        structObj.daylight = daylightDeref === 0 ? null : new UtcOffset(diplomatRuntime.internalConstructor, daylightDeref, []);

        return new VariantOffsets(structObj, internalConstructor);
    }


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

[zur Elbe Produktseite wechseln0.49Quellennavigators]

                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=141584
#Domains=752002