1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
9 public class Result_TrustedClosingTransactionNoneZ extends CommonBase {
10 private Result_TrustedClosingTransactionNoneZ(Object _dummy, long ptr) { super(ptr); }
11 protected void finalize() throws Throwable {
12 if (ptr != 0) { bindings.CResult_TrustedClosingTransactionNoneZ_free(ptr); } super.finalize();
15 static Result_TrustedClosingTransactionNoneZ constr_from_ptr(long ptr) {
16 if (bindings.LDKCResult_TrustedClosingTransactionNoneZ_result_ok(ptr)) {
17 return new Result_TrustedClosingTransactionNoneZ_OK(null, ptr);
19 return new Result_TrustedClosingTransactionNoneZ_Err(null, ptr);
22 public static final class Result_TrustedClosingTransactionNoneZ_OK extends Result_TrustedClosingTransactionNoneZ {
23 public final TrustedClosingTransaction res;
24 private Result_TrustedClosingTransactionNoneZ_OK(Object _dummy, long ptr) {
26 long res = bindings.LDKCResult_TrustedClosingTransactionNoneZ_get_ok(ptr);
27 TrustedClosingTransaction res_hu_conv = new TrustedClosingTransaction(null, res);
28 res_hu_conv.ptrs_to.add(this);
29 this.res = res_hu_conv;
33 public static final class Result_TrustedClosingTransactionNoneZ_Err extends Result_TrustedClosingTransactionNoneZ {
34 private Result_TrustedClosingTransactionNoneZ_Err(Object _dummy, long ptr) {
40 * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
42 public static Result_TrustedClosingTransactionNoneZ ok(TrustedClosingTransaction o) {
43 long ret = bindings.CResult_TrustedClosingTransactionNoneZ_ok(o == null ? 0 : o.ptr & ~1);
44 if (ret < 1024) { return null; }
45 Result_TrustedClosingTransactionNoneZ ret_hu_conv = Result_TrustedClosingTransactionNoneZ.constr_from_ptr(ret);
46 ret_hu_conv.ptrs_to.add(o);
47 // Due to rust's strict-ownership memory model, in some cases we need to "move"
48 // an object to pass exclusive ownership to the function being called.
49 // In most cases, we avoid ret_hu_conv being visible in GC'd languages by cloning the object
50 // at the FFI layer, creating a new object which Rust can claim ownership of
51 // However, in some cases (eg here), there is no way to clone an object, and thus
52 // we actually have to pass full ownership to Rust.
53 // Thus, after ret_hu_conv call, o is reset to null and is now a dummy object.
59 * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
61 public static Result_TrustedClosingTransactionNoneZ err() {
62 long ret = bindings.CResult_TrustedClosingTransactionNoneZ_err();
63 if (ret < 1024) { return null; }
64 Result_TrustedClosingTransactionNoneZ ret_hu_conv = Result_TrustedClosingTransactionNoneZ.constr_from_ptr(ret);