]> git.bitcoin.ninja Git - ldk-java/blob - ts/structs/Option_AccessZ.ts
Merge pull request #47 from TheBlueMatt/main
[ldk-java] / ts / structs / Option_AccessZ.ts
1
2 import CommonBase from './CommonBase';
3 import * as bindings from '../bindings' // TODO: figure out location
4
5 export default class COption_AccessZ extends CommonBase {
6         protected constructor(_dummy: object, ptr: number) { super(ptr); }
7         protected finalize() {
8                 super.finalize();
9                 if (this.ptr != 0) { bindings.COption_AccessZ_free(this.ptr); }
10         }
11         static constr_from_ptr(ptr: number): COption_AccessZ {
12                 const raw_val: bindings.LDKCOption_AccessZ = bindings.LDKCOption_AccessZ_ref_from_ptr(ptr);
13                 if (raw_val instanceof bindings.LDKCOption_AccessZ.Some) {
14                         return new Some(this.ptr, raw_val);
15                 }
16                 if (raw_val instanceof bindings.LDKCOption_AccessZ.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_AccessZ {
24         public some: Access;
25         private constructor(ptr: number, obj: bindings.LDKCOption_AccessZ.Some) {
26                 super(null, ptr);
27                 const some: number = obj.some;
28                 Access ret_hu_conv = new Access(null, some);
29                         ret_hu_conv.ptrs_to.add(this);
30                 this.some = ret_hu_conv;
31         }
32 }
33 export class None extends COption_AccessZ {
34         private constructor(ptr: number, obj: bindings.LDKCOption_AccessZ.None) {
35                 super(null, ptr);
36         }
37 }
38         public static Option_AccessZ constructor_some(Access o) {
39                 number ret = bindings.COption_AccessZ_some(o == null ? 0 : o.ptr);
40                 Option_AccessZ ret_hu_conv = Option_AccessZ.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_AccessZ constructor_none() {
47                 number ret = bindings.COption_AccessZ_none();
48                 Option_AccessZ ret_hu_conv = Option_AccessZ.constr_from_ptr(ret);
49                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
50                 return ret_hu_conv;
51         }
52
53 }