Eine aufbereitete Darstellung der Quelle

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

Benutzer

Quelle  UtcOffset.mjs   Sprache: unbekannt

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

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

const UtcOffset_box_destroy_registry = new FinalizationRegistry((ptr) => {
    wasm.icu4x_UtcOffset_destroy_mv1(ptr);
});

/**
 * See the [Rust documentation for `UtcOffset`](https://docs.rs/icu/2.1.1/icu/time/zone/struct.UtcOffset.html) for more information.
 */
export class UtcOffset {
    // 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 = [];

    #internalConstructor(symbol, ptr, selfEdge) {
        if (symbol !== diplomatRuntime.internalConstructor) {
            console.error("UtcOffset is an Opaque type. You cannot call its constructor.");
            return;
        }
        this.#ptr = ptr;
        this.#selfEdge = selfEdge;

        // Are we being borrowed? If not, we can register.
        if (this.#selfEdge.length === 0) {
            UtcOffset_box_destroy_registry.register(this, this.#ptr);
        }

        return this;
    }
    /** @internal */
    get ffiValue() {
        return this.#ptr;
    }


    /**
     * Creates an offset from seconds.
     *
     * Errors if the offset seconds are out of range.
     *
     * See the [Rust documentation for `try_from_seconds`](https://docs.rs/icu/2.1.1/icu/time/zone/struct.UtcOffset.html#method.try_from_seconds) for more information.
     */
    static fromSeconds(seconds) {
        const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 54, true);


        const result = wasm.icu4x_UtcOffset_from_seconds_mv1(diplomatReceive.buffer, seconds);

        try {
            if (!diplomatReceive.resultFlag) {
                const cause = new TimeZoneInvalidOffsetError();
                throw new globalThis.Error('TimeZoneInvalidOffsetError', { cause });
            }
            return new UtcOffset(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
        }

        finally {
            diplomatReceive.free();
        }
    }

    /**
     * Creates an offset from a string.
     *
     * See the [Rust documentation for `try_from_str`](https://docs.rs/icu/2.1.1/icu/time/zone/struct.UtcOffset.html#method.try_from_str) for more information.
     *
     * Additional information: [1](https://docs.rs/icu/2.1.1/icu/time/zone/struct.UtcOffset.html)
     */
    static fromString(offset) {
        let functionCleanupArena = new diplomatRuntime.CleanupArena();

        const offsetSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, offset)));
        const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 54, true);


        const result = wasm.icu4x_UtcOffset_from_string_mv1(diplomatReceive.buffer, offsetSlice.ptr);

        try {
            if (!diplomatReceive.resultFlag) {
                const cause = new TimeZoneInvalidOffsetError();
                throw new globalThis.Error('TimeZoneInvalidOffsetError', { cause });
            }
            return new UtcOffset(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
        }

        finally {
            functionCleanupArena.free();

            diplomatReceive.free();
        }
    }

    /**
     * Returns the value as offset seconds.
     *
     * See the [Rust documentation for `offset`](https://docs.rs/icu/2.1.1/icu/time/struct.TimeZoneInfo.html#method.offset) for more information.
     *
     * See the [Rust documentation for `to_seconds`](https://docs.rs/icu/2.1.1/icu/time/zone/struct.UtcOffset.html#method.to_seconds) for more information.
     *
     * Additional information: [1](https://docs.rs/icu/2.1.1/icu/time/zone/struct.UtcOffset.html)
     */
    get seconds() {

        const result = wasm.icu4x_UtcOffset_seconds_mv1(this.ffiValue);

        try {
            return result;
        }

        finally {
        }
    }

    /**
     * Returns whether the offset is positive.
     *
     * See the [Rust documentation for `is_non_negative`](https://docs.rs/icu/2.1.1/icu/time/zone/struct.UtcOffset.html#method.is_non_negative) for more information.
     *
     * Additional information: [1](https://docs.rs/icu/2.1.1/icu/time/zone/struct.UtcOffset.html)
     */
    get isNonNegative() {

        const result = wasm.icu4x_UtcOffset_is_non_negative_mv1(this.ffiValue);

        try {
            return result;
        }

        finally {
        }
    }

    /**
     * Returns whether the offset is zero.
     *
     * See the [Rust documentation for `is_zero`](https://docs.rs/icu/2.1.1/icu/time/zone/struct.UtcOffset.html#method.is_zero) for more information.
     *
     * Additional information: [1](https://docs.rs/icu/2.1.1/icu/time/zone/struct.UtcOffset.html)
     */
    get isZero() {

        const result = wasm.icu4x_UtcOffset_is_zero_mv1(this.ffiValue);

        try {
            return result;
        }

        finally {
        }
    }

    /**
     * Returns the hours part of the offset.
     *
     * See the [Rust documentation for `hours_part`](https://docs.rs/icu/2.1.1/icu/time/zone/struct.UtcOffset.html#method.hours_part) for more information.
     *
     * Additional information: [1](https://docs.rs/icu/2.1.1/icu/time/zone/struct.UtcOffset.html)
     */
    get hoursPart() {

        const result = wasm.icu4x_UtcOffset_hours_part_mv1(this.ffiValue);

        try {
            return result;
        }

        finally {
        }
    }

    /**
     * Returns the minutes part of the offset.
     *
     * See the [Rust documentation for `minutes_part`](https://docs.rs/icu/2.1.1/icu/time/zone/struct.UtcOffset.html#method.minutes_part) for more information.
     *
     * Additional information: [1](https://docs.rs/icu/2.1.1/icu/time/zone/struct.UtcOffset.html)
     */
    get minutesPart() {

        const result = wasm.icu4x_UtcOffset_minutes_part_mv1(this.ffiValue);

        try {
            return result;
        }

        finally {
        }
    }

    /**
     * Returns the seconds part of the offset.
     *
     * See the [Rust documentation for `seconds_part`](https://docs.rs/icu/2.1.1/icu/time/zone/struct.UtcOffset.html#method.seconds_part) for more information.
     *
     * Additional information: [1](https://docs.rs/icu/2.1.1/icu/time/zone/struct.UtcOffset.html)
     */
    get secondsPart() {

        const result = wasm.icu4x_UtcOffset_seconds_part_mv1(this.ffiValue);

        try {
            return result;
        }

        finally {
        }
    }

    constructor(symbol, ptr, selfEdge) {
        return this.#internalConstructor(...arguments)
    }
}

[Dauer der Verarbeitung: 0.25 Sekunden, vorverarbeitet 2026-08-25]

                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=752002