2 import CommonBase from './CommonBase';
3 import * as bindings from '../bindings' // TODO: figure out location
5 export default class COption_NetworkUpdateZ extends CommonBase {
6 protected constructor(_dummy: object, ptr: number) { super(ptr); }
9 if (this.ptr != 0) { bindings.COption_NetworkUpdateZ_free(this.ptr); }
11 static constr_from_ptr(ptr: number): COption_NetworkUpdateZ {
12 const raw_val: bindings.LDKCOption_NetworkUpdateZ = bindings.LDKCOption_NetworkUpdateZ_ref_from_ptr(ptr);
13 if (raw_val instanceof bindings.LDKCOption_NetworkUpdateZ.Some) {
14 return new Some(this.ptr, raw_val);
16 if (raw_val instanceof bindings.LDKCOption_NetworkUpdateZ.None) {
17 return new None(this.ptr, raw_val);
19 throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
23 export class Some extends COption_NetworkUpdateZ {
24 public some: NetworkUpdate;
25 private constructor(ptr: number, obj: bindings.LDKCOption_NetworkUpdateZ.Some) {
27 const some: number = obj.some;
28 NetworkUpdate some_hu_conv = NetworkUpdate.constr_from_ptr(some);
29 some_hu_conv.ptrs_to.add(this);
30 this.some = some_hu_conv;
33 export class None extends COption_NetworkUpdateZ {
34 private constructor(ptr: number, obj: bindings.LDKCOption_NetworkUpdateZ.None) {
38 public static Option_NetworkUpdateZ constructor_some(NetworkUpdate o) {
39 number ret = bindings.COption_NetworkUpdateZ_some(o.ptr);
40 Option_NetworkUpdateZ ret_hu_conv = Option_NetworkUpdateZ.constr_from_ptr(ret);
41 ret_hu_conv.ptrs_to.add(ret_hu_conv);
45 public static Option_NetworkUpdateZ constructor_none() {
46 number ret = bindings.COption_NetworkUpdateZ_none();
47 Option_NetworkUpdateZ ret_hu_conv = Option_NetworkUpdateZ.constr_from_ptr(ret);
48 ret_hu_conv.ptrs_to.add(ret_hu_conv);
52 public Option_NetworkUpdateZ clone() {
53 number ret = bindings.COption_NetworkUpdateZ_clone(this.ptr);
54 Option_NetworkUpdateZ ret_hu_conv = Option_NetworkUpdateZ.constr_from_ptr(ret);
55 ret_hu_conv.ptrs_to.add(this);