2 import CommonBase from './CommonBase';
3 import * as bindings from '../bindings' // TODO: figure out location
5 export default class COption_ClosureReasonZ extends CommonBase {
6 protected constructor(_dummy: object, ptr: number) { super(ptr); }
9 if (this.ptr != 0) { bindings.COption_ClosureReasonZ_free(this.ptr); }
11 static constr_from_ptr(ptr: number): COption_ClosureReasonZ {
12 const raw_val: bindings.LDKCOption_ClosureReasonZ = bindings.LDKCOption_ClosureReasonZ_ref_from_ptr(ptr);
13 if (raw_val instanceof bindings.LDKCOption_ClosureReasonZ.Some) {
14 return new Some(this.ptr, raw_val);
16 if (raw_val instanceof bindings.LDKCOption_ClosureReasonZ.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_ClosureReasonZ {
24 public some: ClosureReason;
25 private constructor(ptr: number, obj: bindings.LDKCOption_ClosureReasonZ.Some) {
27 const some: number = obj.some;
28 ClosureReason some_hu_conv = ClosureReason.constr_from_ptr(some);
29 some_hu_conv.ptrs_to.add(this);
30 this.some = some_hu_conv;
33 export class None extends COption_ClosureReasonZ {
34 private constructor(ptr: number, obj: bindings.LDKCOption_ClosureReasonZ.None) {
38 public static Option_ClosureReasonZ constructor_some(ClosureReason o) {
39 number ret = bindings.COption_ClosureReasonZ_some(o.ptr);
40 Option_ClosureReasonZ ret_hu_conv = Option_ClosureReasonZ.constr_from_ptr(ret);
41 ret_hu_conv.ptrs_to.add(ret_hu_conv);
45 public static Option_ClosureReasonZ constructor_none() {
46 number ret = bindings.COption_ClosureReasonZ_none();
47 Option_ClosureReasonZ ret_hu_conv = Option_ClosureReasonZ.constr_from_ptr(ret);
48 ret_hu_conv.ptrs_to.add(ret_hu_conv);
52 public number clone_ptr() {
53 number ret = bindings.COption_ClosureReasonZ_clone_ptr(this.ptr);
57 public Option_ClosureReasonZ clone() {
58 number ret = bindings.COption_ClosureReasonZ_clone(this.ptr);
59 Option_ClosureReasonZ ret_hu_conv = Option_ClosureReasonZ.constr_from_ptr(ret);
60 ret_hu_conv.ptrs_to.add(this);