// generated by diplomat-tool import wasm from "./diplomat-wasm.mjs"; import * as diplomatRuntime from "./diplomat-runtime.mjs"; // Base enumerator definition /** Increment used in a rounding operation. * *See the [Rust documentation for `RoundingIncrement`](https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.RoundingIncrement.html) for more information. */ export class FixedDecimalRoundingIncrement { #value = undefined; static #values = new Map([ ["MultiplesOf1", 0], ["MultiplesOf2", 1], ["MultiplesOf5", 2], ["MultiplesOf25", 3] ]); static getAllEntries() { return FixedDecimalRoundingIncrement.#values.entries(); } constructor(value) { if (arguments.length > 1 && arguments[0] === diplomatRuntime.internalConstructor) { // We pass in two internalConstructor arguments to create *new* // instances of this type, otherwise the enums are treated as singletons. if (arguments[1] === diplomatRuntime.internalConstructor ) { this.#value = arguments[2]; return; } return FixedDecimalRoundingIncrement.#objectValues[arguments[1]]; } if (value instanceof FixedDecimalRoundingIncrement) { return value; } let intVal = FixedDecimalRoundingIncrement.#values.get(value); // Nullish check, checks for null or undefined if (intVal == null) { return FixedDecimalRoundingIncrement.#objectValues[intVal]; } throw TypeError(value + " is not a FixedDecimalRoundingIncrement and does not correspond to any of its enumerator values."); } get value() { return [...FixedDecimalRoundingIncrement.#values.keys()][this.#value]; } get ffiValue() { return this.#value; } static #objectValues = [ new FixedDecimalRoundingIncrement(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0), new FixedDecimalRoundingIncrement(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1), new FixedDecimalRoundingIncrement(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2), new FixedDecimalRoundingIncrement(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 3), ]; static MultiplesOf1 = FixedDecimalRoundingIncrement.#objectValues[0]; static MultiplesOf2 = FixedDecimalRoundingIncrement.#objectValues[1]; static MultiplesOf5 = FixedDecimalRoundingIncrement.#objectValues[2]; static MultiplesOf25 = FixedDecimalRoundingIncrement.#objectValues[3]; }