Update auto-generated bindings
[ldk-java] / ts / structs / Option_TypeZ.ts
1
2 import CommonBase from './CommonBase';
3 import * as bindings from '../bindings' // TODO: figure out location
4
5 export default class COption_TypeZ extends CommonBase {
6         protected constructor(_dummy: object, ptr: number) { super(ptr); }
7         protected finalize() {
8                 super.finalize();
9                 if (this.ptr != 0) { bindings.COption_TypeZ_free(this.ptr); }
10         }
11         static constr_from_ptr(ptr: number): COption_TypeZ {
12                 const raw_val: bindings.LDKCOption_TypeZ = bindings.LDKCOption_TypeZ_ref_from_ptr(ptr);
13                 if (raw_val instanceof bindings.LDKCOption_TypeZ.Some) {
14                         return new Some(this.ptr, raw_val);
15                 }
16                 if (raw_val instanceof bindings.LDKCOption_TypeZ.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_TypeZ {
24         public some: Type;
25         private constructor(ptr: number, obj: bindings.LDKCOption_TypeZ.Some) {
26                 super(null, ptr);
27                 const some: number = obj.some;
28                 Type ret_hu_conv = new Type(null, some);
29                         ret_hu_conv.ptrs_to.add(this);
30                 this.some = ret_hu_conv;
31         }
32 }
33 export class None extends COption_TypeZ {
34         private constructor(ptr: number, obj: bindings.LDKCOption_TypeZ.None) {
35                 super(null, ptr);
36         }
37 }
38         public static Option_TypeZ constructor_some(Type o) {
39                 number ret = bindings.COption_TypeZ_some(o == null ? 0 : o.ptr);
40                 Option_TypeZ ret_hu_conv = Option_TypeZ.constr_from_ptr(ret);
41                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
42                 ret_hu_conv.ptrs_to.add(o);
43                 return ret_hu_conv;
44         }
45
46         public static Option_TypeZ constructor_none() {
47                 number ret = bindings.COption_TypeZ_none();
48                 Option_TypeZ ret_hu_conv = Option_TypeZ.constr_from_ptr(ret);
49                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
50                 return ret_hu_conv;
51         }
52
53         public number clone_ptr() {
54                 number ret = bindings.COption_TypeZ_clone_ptr(this.ptr);
55                 return ret;
56         }
57
58         public Option_TypeZ clone() {
59                 number ret = bindings.COption_TypeZ_clone(this.ptr);
60                 Option_TypeZ ret_hu_conv = Option_TypeZ.constr_from_ptr(ret);
61                 ret_hu_conv.ptrs_to.add(this);
62                 return ret_hu_conv;
63         }
64
65 }