Source code
Revision control
Copy as Markdown
Other Tools
// generated by diplomat-tool
import wasm from "./diplomat-wasm.mjs";
import * as diplomatRuntime from "./diplomat-runtime.mjs";
/**
* Additional information: [1](https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.ParseError.html)
*/
export class DecimalParseError {
#value = undefined;
static #values = new Map([
["Unknown", 0],
["Limit", 1],
["Syntax", 2]
]);
static getAllEntries() {
return DecimalParseError.#values.entries();
}
#internalConstructor(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 this;
}
return DecimalParseError.#objectValues[arguments[1]];
}
if (value instanceof DecimalParseError) {
return value;
}
let intVal = DecimalParseError.#values.get(value);
// Nullish check, checks for null or undefined
if (intVal != null) {
return DecimalParseError.#objectValues[intVal];
}
throw TypeError(value + " is not a DecimalParseError and does not correspond to any of its enumerator values.");
}
static fromValue(value) {
return new DecimalParseError(value);
}
get value(){
return [...DecimalParseError.#values.keys()][this.#value];
}
get ffiValue(){
return this.#value;
}
static #objectValues = [
new DecimalParseError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 0),
new DecimalParseError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 1),
new DecimalParseError(diplomatRuntime.internalConstructor, diplomatRuntime.internalConstructor, 2),
];
static Unknown = DecimalParseError.#objectValues[0];
static Limit = DecimalParseError.#objectValues[1];
static Syntax = DecimalParseError.#objectValues[2];
constructor(value) {
return this.#internalConstructor(...arguments)
}
}