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_NoneSemanticErrorZ extends CommonBase {
11 private Result_NoneSemanticErrorZ(Object _dummy, long ptr) { super(ptr); }
12 protected void finalize() throws Throwable {
13 if (ptr != 0) { bindings.CResult_NoneSemanticErrorZ_free(ptr); } super.finalize();
16 static Result_NoneSemanticErrorZ constr_from_ptr(long ptr) {
17 if (bindings.CResult_NoneSemanticErrorZ_is_ok(ptr)) {
18 return new Result_NoneSemanticErrorZ_OK(null, ptr);
20 return new Result_NoneSemanticErrorZ_Err(null, ptr);
23 public static final class Result_NoneSemanticErrorZ_OK extends Result_NoneSemanticErrorZ {
24 private Result_NoneSemanticErrorZ_OK(Object _dummy, long ptr) {
29 public static final class Result_NoneSemanticErrorZ_Err extends Result_NoneSemanticErrorZ {
30 public final SemanticError err;
31 private Result_NoneSemanticErrorZ_Err(Object _dummy, long ptr) {
33 this.err = bindings.CResult_NoneSemanticErrorZ_get_err(ptr);
38 * Creates a new CResult_NoneSemanticErrorZ in the success state.
40 public static Result_NoneSemanticErrorZ ok() {
41 long ret = bindings.CResult_NoneSemanticErrorZ_ok();
42 if (ret >= 0 && ret <= 4096) { return null; }
43 Result_NoneSemanticErrorZ ret_hu_conv = Result_NoneSemanticErrorZ.constr_from_ptr(ret);
48 * Creates a new CResult_NoneSemanticErrorZ in the error state.
50 public static Result_NoneSemanticErrorZ err(org.ldk.enums.SemanticError e) {
51 long ret = bindings.CResult_NoneSemanticErrorZ_err(e);
52 Reference.reachabilityFence(e);
53 if (ret >= 0 && ret <= 4096) { return null; }
54 Result_NoneSemanticErrorZ ret_hu_conv = Result_NoneSemanticErrorZ.constr_from_ptr(ret);
59 * Checks if the given object is currently in the success state
61 public boolean is_ok() {
62 boolean ret = bindings.CResult_NoneSemanticErrorZ_is_ok(this.ptr);
63 Reference.reachabilityFence(this);
68 long ret = bindings.CResult_NoneSemanticErrorZ_clone_ptr(this.ptr);
69 Reference.reachabilityFence(this);
74 * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
75 * but with all dynamically-allocated buffers duplicated in new buffers.
77 public Result_NoneSemanticErrorZ clone() {
78 long ret = bindings.CResult_NoneSemanticErrorZ_clone(this.ptr);
79 Reference.reachabilityFence(this);
80 if (ret >= 0 && ret <= 4096) { return null; }
81 Result_NoneSemanticErrorZ ret_hu_conv = Result_NoneSemanticErrorZ.constr_from_ptr(ret);