X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-java;a=blobdiff_plain;f=ts%2Fstructs%2FOption_u16Z.mts;h=d4e45335d6a81d9520c22948252d84284385f1a5;hp=52069302364f400ff3ade0e21554547cd1f65784;hb=7d372e434499e36b8be0d090ef733a03650dec6e;hpb=d87886bb194886ef86d3597a5cdc142b6ccc89e9 diff --git a/ts/structs/Option_u16Z.mts b/ts/structs/Option_u16Z.mts index 52069302..d4e45335 100644 --- a/ts/structs/Option_u16Z.mts +++ b/ts/structs/Option_u16Z.mts @@ -279,20 +279,18 @@ import { MultiThreadedLockableScore } from '../structs/MultiThreadedLockableScor import CommonBase from './CommonBase.mjs'; import * as bindings from '../bindings.mjs' -import * as InternalUtils from '../InternalUtils.mjs' export class Option_u16Z extends CommonBase { protected constructor(_dummy: object, ptr: number) { super(ptr, bindings.COption_u16Z_free); } /* @internal */ public static constr_from_ptr(ptr: number): Option_u16Z { - const raw_val: bindings.LDKCOption_u16Z = bindings.LDKCOption_u16Z_ref_from_ptr(ptr); - if (raw_val instanceof bindings.LDKCOption_u16Z_Some) { - return new Option_u16Z_Some(ptr, raw_val); + const raw_ty: number = bindings.LDKCOption_u16Z_ty_from_ptr(ptr); + switch (raw_ty) { + case 0: return new Option_u16Z_Some(ptr); + case 1: return new Option_u16Z_None(ptr); + default: + throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface } - if (raw_val instanceof bindings.LDKCOption_u16Z_None) { - return new Option_u16Z_None(ptr, raw_val); - } - throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface } public static constructor_some(o: number): Option_u16Z { @@ -325,14 +323,14 @@ export class Option_u16Z extends CommonBase { export class Option_u16Z_Some extends Option_u16Z { public some: number; /* @internal */ - public constructor(ptr: number, obj: bindings.LDKCOption_u16Z_Some) { + public constructor(ptr: number) { super(null, ptr); - this.some = obj.some; + this.some = bindings.LDKCOption_u16Z_Some_get_some(ptr); } } export class Option_u16Z_None extends Option_u16Z { /* @internal */ - public constructor(ptr: number, obj: bindings.LDKCOption_u16Z_None) { + public constructor(ptr: number) { super(null, ptr); } }