bb5228aa315414f1fc692c814b133febf7c44097
[ldk-java] / c_sharp / src / org / ldk / structs / Result_COption_NetworkUpdateZDecodeErrorZ.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_COption_NetworkUpdateZDecodeErrorZ : CommonBase {
9         Result_COption_NetworkUpdateZDecodeErrorZ(object _dummy, long ptr) : base(ptr) { }
10         ~Result_COption_NetworkUpdateZDecodeErrorZ() {
11                 if (ptr != 0) { bindings.CResult_COption_NetworkUpdateZDecodeErrorZ_free(ptr); }
12         }
13
14         internal static Result_COption_NetworkUpdateZDecodeErrorZ constr_from_ptr(long ptr) {
15                 if (bindings.CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(ptr)) {
16                         return new Result_COption_NetworkUpdateZDecodeErrorZ_OK(null, ptr);
17                 } else {
18                         return new Result_COption_NetworkUpdateZDecodeErrorZ_Err(null, ptr);
19                 }
20         }
21         public class Result_COption_NetworkUpdateZDecodeErrorZ_OK : Result_COption_NetworkUpdateZDecodeErrorZ {
22                 public readonly Option_NetworkUpdateZ res;
23                 internal Result_COption_NetworkUpdateZDecodeErrorZ_OK(object _dummy, long ptr) : base(_dummy, ptr) {
24                         long res = bindings.CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(ptr);
25                         org.ldk.structs.Option_NetworkUpdateZ res_hu_conv = org.ldk.structs.Option_NetworkUpdateZ.constr_from_ptr(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_COption_NetworkUpdateZDecodeErrorZ_Err : Result_COption_NetworkUpdateZDecodeErrorZ {
32                 public readonly DecodeError err;
33                 internal Result_COption_NetworkUpdateZDecodeErrorZ_Err(object _dummy, long ptr) : base(_dummy, ptr) {
34                         long err = bindings.CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(ptr);
35                         org.ldk.structs.DecodeError err_hu_conv = org.ldk.structs.DecodeError.constr_from_ptr(err);
36                         if (err_hu_conv != null) { err_hu_conv.ptrs_to.AddLast(this); };
37                         this.err = err_hu_conv;
38                 }
39         }
40
41         /**
42          * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
43          */
44         public static Result_COption_NetworkUpdateZDecodeErrorZ ok(org.ldk.structs.Option_NetworkUpdateZ o) {
45                 long ret = bindings.CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o.ptr);
46                 GC.KeepAlive(o);
47                 if (ret >= 0 && ret <= 4096) { return null; }
48                 Result_COption_NetworkUpdateZDecodeErrorZ ret_hu_conv = Result_COption_NetworkUpdateZDecodeErrorZ.constr_from_ptr(ret);
49                 return ret_hu_conv;
50         }
51
52         /**
53          * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
54          */
55         public static Result_COption_NetworkUpdateZDecodeErrorZ err(org.ldk.structs.DecodeError e) {
56                 long ret = bindings.CResult_COption_NetworkUpdateZDecodeErrorZ_err(e.ptr);
57                 GC.KeepAlive(e);
58                 if (ret >= 0 && ret <= 4096) { return null; }
59                 Result_COption_NetworkUpdateZDecodeErrorZ ret_hu_conv = Result_COption_NetworkUpdateZDecodeErrorZ.constr_from_ptr(ret);
60                 return ret_hu_conv;
61         }
62
63         /**
64          * Checks if the given object is currently in the success state
65          */
66         public bool is_ok() {
67                 bool ret = bindings.CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(this.ptr);
68                 GC.KeepAlive(this);
69                 return ret;
70         }
71
72         internal long clone_ptr() {
73                 long ret = bindings.CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(this.ptr);
74                 GC.KeepAlive(this);
75                 return ret;
76         }
77
78         /**
79          * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
80          * but with all dynamically-allocated buffers duplicated in new buffers.
81          */
82         public Result_COption_NetworkUpdateZDecodeErrorZ clone() {
83                 long ret = bindings.CResult_COption_NetworkUpdateZDecodeErrorZ_clone(this.ptr);
84                 GC.KeepAlive(this);
85                 if (ret >= 0 && ret <= 4096) { return null; }
86                 Result_COption_NetworkUpdateZDecodeErrorZ ret_hu_conv = Result_COption_NetworkUpdateZDecodeErrorZ.constr_from_ptr(ret);
87                 return ret_hu_conv;
88         }
89
90 }
91 } } }