[TS] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[ldk-java] / c_sharp / src / org / ldk / structs / Result_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8 public class Result_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ : CommonBase {
9         Result_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ(object _dummy, long ptr) : base(ptr) { }
10         ~Result_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ() {
11                 if (ptr != 0) { bindings.CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free(ptr); }
12         }
13
14         internal static Result_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ constr_from_ptr(long ptr) {
15                 if (bindings.CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok(ptr)) {
16                         return new Result_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_OK(null, ptr);
17                 } else {
18                         return new Result_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_Err(null, ptr);
19                 }
20         }
21         public class Result_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_OK : Result_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
22                 public readonly InvoiceRequestWithExplicitPayerIdBuilder res;
23                 internal Result_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_OK(object _dummy, long ptr) : base(_dummy, ptr) {
24                         long res = bindings.CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_ok(ptr);
25                         org.ldk.structs.InvoiceRequestWithExplicitPayerIdBuilder res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new org.ldk.structs.InvoiceRequestWithExplicitPayerIdBuilder(null, res); }
26                         if (res_hu_conv != null) { res_hu_conv.ptrs_to.AddLast(this); };
27                         this.res = res_hu_conv;
28                 }
29         }
30
31         public class Result_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_Err : Result_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ {
32                 public readonly Bolt12SemanticError err;
33                 internal Result_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_Err(object _dummy, long ptr) : base(_dummy, ptr) {
34                         this.err = bindings.CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_err(ptr);
35                 }
36         }
37
38         /**
39          * Creates a new CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ in the success state.
40          */
41         public static Result_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ ok(org.ldk.structs.InvoiceRequestWithExplicitPayerIdBuilder o) {
42                 long ret = bindings.CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_ok(o.ptr);
43                 GC.KeepAlive(o);
44                 if (ret >= 0 && ret <= 4096) { return null; }
45                 Result_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ ret_hu_conv = Result_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ.constr_from_ptr(ret);
46                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(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.
54                 o.ptr = 0;;
55                 return ret_hu_conv;
56         }
57
58         /**
59          * Creates a new CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ in the error state.
60          */
61         public static Result_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ err(Bolt12SemanticError e) {
62                 long ret = bindings.CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_err(e);
63                 GC.KeepAlive(e);
64                 if (ret >= 0 && ret <= 4096) { return null; }
65                 Result_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ ret_hu_conv = Result_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ.constr_from_ptr(ret);
66                 return ret_hu_conv;
67         }
68
69         /**
70          * Checks if the given object is currently in the success state
71          */
72         public bool is_ok() {
73                 bool ret = bindings.CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok(this.ptr);
74                 GC.KeepAlive(this);
75                 return ret;
76         }
77
78 }
79 } } }