Eine aufbereitete Darstellung der Quelle

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

Benutzer

Quelle  TimeZoneAndCanonical.mjs   Sprache: unbekannt

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

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



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

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

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

        return this;
    }

    // Return this struct in FFI function friendly format.
    // Returns an array that can be expanded with spread syntax (...)// If this struct contains any slices, their lifetime-edge-relevant information will be
    // set up here, and can be appended to any relevant lifetime arrays here. <lifetime>AppendArray accepts a list
    // of arrays for each lifetime to do so. It accepts multiple lists per lifetime in case the caller needs to tie a lifetime to multiple
    // output arrays. Null is equivalent to an empty list: this lifetime is not being borrowed from.
    _intoFFI(
        functionCleanupArena,
        appendArrayMap
    ) {
        let buffer = diplomatRuntime.DiplomatBuf.struct(wasm, 124);

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

        return TimeZoneAndCanonical.fromFields(obj);
    }

    _writeToArrayBuffer(
        arrayBuffer,
        offset,
        functionCleanupArena,
        appendArrayMap
    ) {
        diplomatRuntime.writeToArrayBuffer(arrayBuffer, offset + 0, this.#timeZone.ffiValue, Uint32Array);
        diplomatRuntime.CleanupArena.maybeCreateWith(functionCleanupArena, ...appendArrayMap['aAppendArray']).alloc(diplomatRuntime.DiplomatBuf.str8(wasm, this.#canonical)).writePtrLenToArrayBuffer(arrayBuffer, offset + 4);
    }

    static _fromFFI(internalConstructor, ptr, aEdges) {
        if (internalConstructor !== diplomatRuntime.internalConstructor) {
            throw new Error("TimeZoneAndCanonical._fromFFI is not meant to be called externally. Please use the default constructor.");
        }
        let structObj = {};
        const timeZoneDeref = diplomatRuntime.ptrRead(wasm, ptr);
        structObj.timeZone = new TimeZone(diplomatRuntime.internalConstructor, timeZoneDeref, []);
        const canonicalDeref = ptr + 4;
        structObj.canonical = new diplomatRuntime.DiplomatSliceStr(wasm, canonicalDeref,  "string8", aEdges).getValue();

        return new TimeZoneAndCanonical(structObj, internalConstructor);
    }

    // Return all fields corresponding to lifetime `'a`
    // without handling lifetime dependencies (this is the job of the caller)
    // This is all fields that may be borrowed from if borrowing `'a`,
    // assuming that there are no `'other: a`. bounds. In case of such bounds,
    // the caller should take care to also call _fieldsForLifetimeOther
    get _fieldsForLifetimeA() {
        return [this.#canonical];
    };


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

[Dauer der Verarbeitung: 0.49 Sekunden]

                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=141584
#Domains=752002