2 import CommonBase from './CommonBase';
3 import * as bindings from '../bindings' // TODO: figure out location
5 export default class COption_u64Z extends CommonBase {
6 protected constructor(_dummy: object, ptr: number) { super(ptr); }
9 if (this.ptr != 0) { bindings.COption_u64Z_free(this.ptr); }
11 static constr_from_ptr(ptr: number): COption_u64Z {
12 const raw_val: bindings.LDKCOption_u64Z = bindings.LDKCOption_u64Z_ref_from_ptr(ptr);
13 if (raw_val instanceof bindings.LDKCOption_u64Z.Some) {
14 return new Some(this.ptr, raw_val);
16 if (raw_val instanceof bindings.LDKCOption_u64Z.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_u64Z {
25 private constructor(ptr: number, obj: bindings.LDKCOption_u64Z.Some) {
30 export class None extends COption_u64Z {
31 private constructor(ptr: number, obj: bindings.LDKCOption_u64Z.None) {
35 public static Option_u64Z constructor_some(number o) {
36 number ret = bindings.COption_u64Z_some(o);
37 Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret);
38 ret_hu_conv.ptrs_to.add(ret_hu_conv);
42 public static Option_u64Z constructor_none() {
43 number ret = bindings.COption_u64Z_none();
44 Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret);
45 ret_hu_conv.ptrs_to.add(ret_hu_conv);
49 public Option_u64Z clone() {
50 number ret = bindings.COption_u64Z_clone(this.ptr);
51 Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret);
52 ret_hu_conv.ptrs_to.add(this);