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_TrustedCommitmentTransactionNoneZ extends CommonBase {
9 private Result_TrustedCommitmentTransactionNoneZ(Object _dummy, long ptr) { super(ptr); }
10 protected void finalize() throws Throwable {
11 if (ptr != 0) { bindings.CResult_TrustedCommitmentTransactionNoneZ_free(ptr); } super.finalize();
14 static Result_TrustedCommitmentTransactionNoneZ constr_from_ptr(long ptr) {
15 if (bindings.LDKCResult_TrustedCommitmentTransactionNoneZ_result_ok(ptr)) {
16 return new Result_TrustedCommitmentTransactionNoneZ_OK(null, ptr);
18 return new Result_TrustedCommitmentTransactionNoneZ_Err(null, ptr);
21 public static final class Result_TrustedCommitmentTransactionNoneZ_OK extends Result_TrustedCommitmentTransactionNoneZ {
22 public final TrustedCommitmentTransaction res;
23 private Result_TrustedCommitmentTransactionNoneZ_OK(Object _dummy, long ptr) {
25 long res = bindings.LDKCResult_TrustedCommitmentTransactionNoneZ_get_ok(ptr);
26 TrustedCommitmentTransaction res_hu_conv = new TrustedCommitmentTransaction(null, res);
27 res_hu_conv.ptrs_to.add(this);
28 this.res = res_hu_conv;
30 public Result_TrustedCommitmentTransactionNoneZ_OK(TrustedCommitmentTransaction res) {
31 this(null, bindings.CResult_TrustedCommitmentTransactionNoneZ_ok(res == null ? 0 : res.ptr & ~1));
32 this.ptrs_to.add(res);
33 // Due to rust's strict-ownership memory model, in some cases we need to "move"
34 // an object to pass exclusive ownership to the function being called.
35 // In most cases, we avoid this being visible in GC'd languages by cloning the object
36 // at the FFI layer, creating a new object which Rust can claim ownership of
37 // However, in some cases (eg here), there is no way to clone an object, and thus
38 // we actually have to pass full ownership to Rust.
39 // Thus, after this call, res is reset to null and is now a dummy object.
44 public static final class Result_TrustedCommitmentTransactionNoneZ_Err extends Result_TrustedCommitmentTransactionNoneZ {
45 private Result_TrustedCommitmentTransactionNoneZ_Err(Object _dummy, long ptr) {
48 public Result_TrustedCommitmentTransactionNoneZ_Err() {
49 this(null, bindings.CResult_TrustedCommitmentTransactionNoneZ_err());