1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
10 public class Result_NoneBolt11SemanticErrorZ extends CommonBase {
11 private Result_NoneBolt11SemanticErrorZ(Object _dummy, long ptr) { super(ptr); }
12 protected void finalize() throws Throwable {
13 if (ptr != 0) { bindings.CResult_NoneBolt11SemanticErrorZ_free(ptr); } super.finalize();
16 protected void force_free() {
17 if (ptr != 0) { bindings.CResult_NoneBolt11SemanticErrorZ_free(ptr); ptr = 0; }
20 static Result_NoneBolt11SemanticErrorZ constr_from_ptr(long ptr) {
21 if (bindings.CResult_NoneBolt11SemanticErrorZ_is_ok(ptr)) {
22 return new Result_NoneBolt11SemanticErrorZ_OK(null, ptr);
24 return new Result_NoneBolt11SemanticErrorZ_Err(null, ptr);
27 public static final class Result_NoneBolt11SemanticErrorZ_OK extends Result_NoneBolt11SemanticErrorZ {
28 private Result_NoneBolt11SemanticErrorZ_OK(Object _dummy, long ptr) {
33 public static final class Result_NoneBolt11SemanticErrorZ_Err extends Result_NoneBolt11SemanticErrorZ {
34 public final Bolt11SemanticError err;
35 private Result_NoneBolt11SemanticErrorZ_Err(Object _dummy, long ptr) {
37 this.err = bindings.CResult_NoneBolt11SemanticErrorZ_get_err(ptr);
42 * Creates a new CResult_NoneBolt11SemanticErrorZ in the success state.
44 public static Result_NoneBolt11SemanticErrorZ ok() {
45 long ret = bindings.CResult_NoneBolt11SemanticErrorZ_ok();
46 if (ret >= 0 && ret <= 4096) { return null; }
47 Result_NoneBolt11SemanticErrorZ ret_hu_conv = Result_NoneBolt11SemanticErrorZ.constr_from_ptr(ret);
52 * Creates a new CResult_NoneBolt11SemanticErrorZ in the error state.
54 public static Result_NoneBolt11SemanticErrorZ err(org.ldk.enums.Bolt11SemanticError e) {
55 long ret = bindings.CResult_NoneBolt11SemanticErrorZ_err(e);
56 Reference.reachabilityFence(e);
57 if (ret >= 0 && ret <= 4096) { return null; }
58 Result_NoneBolt11SemanticErrorZ ret_hu_conv = Result_NoneBolt11SemanticErrorZ.constr_from_ptr(ret);
63 * Checks if the given object is currently in the success state
65 public boolean is_ok() {
66 boolean ret = bindings.CResult_NoneBolt11SemanticErrorZ_is_ok(this.ptr);
67 Reference.reachabilityFence(this);
72 long ret = bindings.CResult_NoneBolt11SemanticErrorZ_clone_ptr(this.ptr);
73 Reference.reachabilityFence(this);
78 * Creates a new CResult_NoneBolt11SemanticErrorZ which has the same data as `orig`
79 * but with all dynamically-allocated buffers duplicated in new buffers.
81 public Result_NoneBolt11SemanticErrorZ clone() {
82 long ret = bindings.CResult_NoneBolt11SemanticErrorZ_clone(this.ptr);
83 Reference.reachabilityFence(this);
84 if (ret >= 0 && ret <= 4096) { return null; }
85 Result_NoneBolt11SemanticErrorZ ret_hu_conv = Result_NoneBolt11SemanticErrorZ.constr_from_ptr(ret);