6 namespace org { namespace ldk { namespace structs {
8 public class Result_TrustedCommitmentTransactionNoneZ : CommonBase {
9 Result_TrustedCommitmentTransactionNoneZ(object _dummy, long ptr) : base(ptr) { }
10 ~Result_TrustedCommitmentTransactionNoneZ() {
11 if (ptr != 0) { bindings.CResult_TrustedCommitmentTransactionNoneZ_free(ptr); }
14 internal static Result_TrustedCommitmentTransactionNoneZ constr_from_ptr(long ptr) {
15 if (bindings.CResult_TrustedCommitmentTransactionNoneZ_is_ok(ptr)) {
16 return new Result_TrustedCommitmentTransactionNoneZ_OK(null, ptr);
18 return new Result_TrustedCommitmentTransactionNoneZ_Err(null, ptr);
21 public class Result_TrustedCommitmentTransactionNoneZ_OK : Result_TrustedCommitmentTransactionNoneZ {
22 public readonly TrustedCommitmentTransaction res;
23 internal Result_TrustedCommitmentTransactionNoneZ_OK(object _dummy, long ptr) : base(_dummy, ptr) {
24 long res = bindings.CResult_TrustedCommitmentTransactionNoneZ_get_ok(ptr);
25 org.ldk.structs.TrustedCommitmentTransaction res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new org.ldk.structs.TrustedCommitmentTransaction(null, res); }
26 if (res_hu_conv != null) { res_hu_conv.ptrs_to.AddLast(this); };
27 this.res = res_hu_conv;
31 public class Result_TrustedCommitmentTransactionNoneZ_Err : Result_TrustedCommitmentTransactionNoneZ {
32 internal Result_TrustedCommitmentTransactionNoneZ_Err(object _dummy, long ptr) : base(_dummy, ptr) {
37 * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
39 public static Result_TrustedCommitmentTransactionNoneZ ok(org.ldk.structs.TrustedCommitmentTransaction o) {
40 long ret = bindings.CResult_TrustedCommitmentTransactionNoneZ_ok(o.ptr);
42 if (ret >= 0 && ret <= 4096) { return null; }
43 Result_TrustedCommitmentTransactionNoneZ ret_hu_conv = Result_TrustedCommitmentTransactionNoneZ.constr_from_ptr(ret);
44 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(o); };
45 // Due to rust's strict-ownership memory model, in some cases we need to "move"
46 // an object to pass exclusive ownership to the function being called.
47 // In most cases, we avoid ret_hu_conv being visible in GC'd languages by cloning the object
48 // at the FFI layer, creating a new object which Rust can claim ownership of
49 // However, in some cases (eg here), there is no way to clone an object, and thus
50 // we actually have to pass full ownership to Rust.
51 // Thus, after ret_hu_conv call, o is reset to null and is now a dummy object.
57 * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
59 public static Result_TrustedCommitmentTransactionNoneZ err() {
60 long ret = bindings.CResult_TrustedCommitmentTransactionNoneZ_err();
61 if (ret >= 0 && ret <= 4096) { return null; }
62 Result_TrustedCommitmentTransactionNoneZ ret_hu_conv = Result_TrustedCommitmentTransactionNoneZ.constr_from_ptr(ret);
67 * Checks if the given object is currently in the success state
70 bool ret = bindings.CResult_TrustedCommitmentTransactionNoneZ_is_ok(this.ptr);