]> git.bitcoin.ninja Git - ldk-java/blob - ts/structs/Option_ClosureReasonZ.ts
Merge pull request #69 from TheBlueMatt/main
[ldk-java] / ts / structs / Option_ClosureReasonZ.ts
1
2 import CommonBase from './CommonBase';
3 import * as bindings from '../bindings' // TODO: figure out location
4
5 export default class COption_ClosureReasonZ extends CommonBase {
6         protected constructor(_dummy: object, ptr: number) { super(ptr); }
7         protected finalize() {
8                 super.finalize();
9                 if (this.ptr != 0) { bindings.COption_ClosureReasonZ_free(this.ptr); }
10         }
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);
15                 }
16                 if (raw_val instanceof bindings.LDKCOption_ClosureReasonZ.None) {
17                         return new None(this.ptr, raw_val);
18                 }
19                 throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
20         }
21
22 }
23 export class Some extends COption_ClosureReasonZ {
24         public some: ClosureReason;
25         private constructor(ptr: number, obj: bindings.LDKCOption_ClosureReasonZ.Some) {
26                 super(null, ptr);
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;
31         }
32 }
33 export class None extends COption_ClosureReasonZ {
34         private constructor(ptr: number, obj: bindings.LDKCOption_ClosureReasonZ.None) {
35                 super(null, ptr);
36         }
37 }
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);
42                 return ret_hu_conv;
43         }
44
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);
49                 return ret_hu_conv;
50         }
51
52         public number clone_ptr() {
53                 number ret = bindings.COption_ClosureReasonZ_clone_ptr(this.ptr);
54                 return ret;
55         }
56
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);
61                 return ret_hu_conv;
62         }
63
64 }