2 import CommonBase from './CommonBase';
3 import * as bindings from '../bindings' // TODO: figure out location
5 export default class COption_AccessZ extends CommonBase {
6 protected constructor(_dummy: object, ptr: number) { super(ptr); }
9 if (this.ptr != 0) { bindings.COption_AccessZ_free(this.ptr); }
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);
16 if (raw_val instanceof bindings.LDKCOption_AccessZ.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_AccessZ {
25 private constructor(ptr: number, obj: bindings.LDKCOption_AccessZ.Some) {
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;
33 export class None extends COption_AccessZ {
34 private constructor(ptr: number, obj: bindings.LDKCOption_AccessZ.None) {
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);
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);