1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
8 public class Result_InvoiceSemanticErrorZ extends CommonBase {
9 private Result_InvoiceSemanticErrorZ(Object _dummy, long ptr) { super(ptr); }
10 protected void finalize() throws Throwable {
11 if (ptr != 0) { bindings.CResult_InvoiceSemanticErrorZ_free(ptr); } super.finalize();
14 static Result_InvoiceSemanticErrorZ constr_from_ptr(long ptr) {
15 if (bindings.LDKCResult_InvoiceSemanticErrorZ_result_ok(ptr)) {
16 return new Result_InvoiceSemanticErrorZ_OK(null, ptr);
18 return new Result_InvoiceSemanticErrorZ_Err(null, ptr);
21 public static final class Result_InvoiceSemanticErrorZ_OK extends Result_InvoiceSemanticErrorZ {
22 public final Invoice res;
23 private Result_InvoiceSemanticErrorZ_OK(Object _dummy, long ptr) {
25 long res = bindings.LDKCResult_InvoiceSemanticErrorZ_get_ok(ptr);
26 Invoice res_hu_conv = new Invoice(null, res);
27 res_hu_conv.ptrs_to.add(this);
28 this.res = res_hu_conv;
32 public static final class Result_InvoiceSemanticErrorZ_Err extends Result_InvoiceSemanticErrorZ {
33 public final SemanticError err;
34 private Result_InvoiceSemanticErrorZ_Err(Object _dummy, long ptr) {
36 this.err = bindings.LDKCResult_InvoiceSemanticErrorZ_get_err(ptr);
41 * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
43 public static Result_InvoiceSemanticErrorZ ok(Invoice o) {
44 long ret = bindings.CResult_InvoiceSemanticErrorZ_ok(o == null ? 0 : o.ptr & ~1);
45 if (ret < 1024) { return null; }
46 Result_InvoiceSemanticErrorZ ret_hu_conv = Result_InvoiceSemanticErrorZ.constr_from_ptr(ret);
47 ret_hu_conv.ptrs_to.add(o);
52 * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
54 public static Result_InvoiceSemanticErrorZ err(SemanticError e) {
55 long ret = bindings.CResult_InvoiceSemanticErrorZ_err(e);
56 if (ret < 1024) { return null; }
57 Result_InvoiceSemanticErrorZ ret_hu_conv = Result_InvoiceSemanticErrorZ.constr_from_ptr(ret);
62 * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
63 * but with all dynamically-allocated buffers duplicated in new buffers.
65 public Result_InvoiceSemanticErrorZ clone() {
66 long ret = bindings.CResult_InvoiceSemanticErrorZ_clone(this.ptr);
67 if (ret < 1024) { return null; }
68 Result_InvoiceSemanticErrorZ ret_hu_conv = Result_InvoiceSemanticErrorZ.constr_from_ptr(ret);