tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

DateTimeFormatterLoadError.mjs (5168B)


      1 // generated by diplomat-tool
      2 import wasm from "./diplomat-wasm.mjs";
      3 import * as diplomatRuntime from "./diplomat-runtime.mjs";
      4 
      5 
      6 /**
      7 * Additional information: [1](https://docs.rs/icu/latest/icu/datetime/enum.DateTimeFormatterLoadError.html), [2](https://docs.rs/icu/latest/icu/datetime/pattern/enum.PatternLoadError.html), [3](https://docs.rs/icu_provider/latest/icu_provider/struct.DataError.html), [4](https://docs.rs/icu_provider/latest/icu_provider/enum.DataErrorKind.html)
      8 */
      9 
     10 
     11 export class DateTimeFormatterLoadError {
     12    #value = undefined;
     13 
     14    static #values = new Map([
     15        ["Unknown", 0],
     16        ["InvalidDateFields", 2049],
     17        ["UnsupportedLength", 2051],
     18        ["ConflictingField", 2057],
     19        ["FormatterTooSpecific", 2058],
     20        ["DataMarkerNotFound", 1],
     21        ["DataIdentifierNotFound", 2],
     22        ["DataInvalidRequest", 3],
     23        ["DataInconsistentData", 4],
     24        ["DataDowncast", 5],
     25        ["DataDeserialize", 6],
     26        ["DataCustom", 7],
     27        ["DataIo", 8]
     28    ]);
     29 
     30    static getAllEntries() {
     31        return DateTimeFormatterLoadError.#values.entries();
     32    }
     33 
     34    #internalConstructor(value) {
     35        if (arguments.length > 1 && arguments[0] === diplomatRuntime.internalConstructor) {
     36            // We pass in two internalConstructor arguments to create *new*
     37            // instances of this type, otherwise the enums are treated as singletons.
     38            if (arguments[1] === diplomatRuntime.internalConstructor ) {
     39                this.#value = arguments[2];
     40                return this;
     41            }
     42            return DateTimeFormatterLoadError.#objectValues[arguments[1]];
     43        }
     44 
     45        if (value instanceof DateTimeFormatterLoadError) {
     46            return value;
     47        }
     48 
     49        let intVal = DateTimeFormatterLoadError.#values.get(value);
     50 
     51        // Nullish check, checks for null or undefined
     52        if (intVal != null) {
     53            return DateTimeFormatterLoadError.#objectValues[intVal];
     54        }
     55 
     56        throw TypeError(value + " is not a DateTimeFormatterLoadError and does not correspond to any of its enumerator values.");
     57    }
     58 
     59    static fromValue(value) {
     60        return new DateTimeFormatterLoadError(value);
     61    }
     62 
     63    get value(){
     64        for (let entry of DateTimeFormatterLoadError.#values) {
     65            if (entry[1] == this.#value) {
     66                return entry[0];
     67            }
     68        }
     69    }
     70 
     71    get ffiValue(){
     72        return this.#value;
     73    }
     74    static #objectValues = {
     75        [0]: new DateTimeFormatterLoadError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
     76        [2049]: new DateTimeFormatterLoadError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2049),
     77        [2051]: new DateTimeFormatterLoadError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2051),
     78        [2057]: new DateTimeFormatterLoadError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2057),
     79        [2058]: new DateTimeFormatterLoadError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2058),
     80        [1]: new DateTimeFormatterLoadError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
     81        [2]: new DateTimeFormatterLoadError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
     82        [3]: new DateTimeFormatterLoadError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 3),
     83        [4]: new DateTimeFormatterLoadError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 4),
     84        [5]: new DateTimeFormatterLoadError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 5),
     85        [6]: new DateTimeFormatterLoadError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 6),
     86        [7]: new DateTimeFormatterLoadError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 7),
     87        [8]: new DateTimeFormatterLoadError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 8),
     88    };
     89 
     90    static Unknown = DateTimeFormatterLoadError.#objectValues[0];
     91    static InvalidDateFields = DateTimeFormatterLoadError.#objectValues[2049];
     92    static UnsupportedLength = DateTimeFormatterLoadError.#objectValues[2051];
     93    static ConflictingField = DateTimeFormatterLoadError.#objectValues[2057];
     94    static FormatterTooSpecific = DateTimeFormatterLoadError.#objectValues[2058];
     95    static DataMarkerNotFound = DateTimeFormatterLoadError.#objectValues[1];
     96    static DataIdentifierNotFound = DateTimeFormatterLoadError.#objectValues[2];
     97    static DataInvalidRequest = DateTimeFormatterLoadError.#objectValues[3];
     98    static DataInconsistentData = DateTimeFormatterLoadError.#objectValues[4];
     99    static DataDowncast = DateTimeFormatterLoadError.#objectValues[5];
    100    static DataDeserialize = DateTimeFormatterLoadError.#objectValues[6];
    101    static DataCustom = DateTimeFormatterLoadError.#objectValues[7];
    102    static DataIo = DateTimeFormatterLoadError.#objectValues[8];
    103 
    104 
    105    constructor(value) {
    106        return this.#internalConstructor(...arguments)
    107    }
    108 }