]> git.bitcoin.ninja Git - ldk-java/blob - c_sharp/src/org/ldk/structs/Result_CVec_u8ZPeerHandleErrorZ.cs
Update CI references to LDK 0.0.124 drop stale memchr pins
[ldk-java] / c_sharp / src / org / ldk / structs / Result_CVec_u8ZPeerHandleErrorZ.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_CVec_u8ZPeerHandleErrorZ : CommonBase {
9         Result_CVec_u8ZPeerHandleErrorZ(object _dummy, long ptr) : base(ptr) { }
10         ~Result_CVec_u8ZPeerHandleErrorZ() {
11                 if (ptr != 0) { bindings.CResult_CVec_u8ZPeerHandleErrorZ_free(ptr); }
12         }
13
14         internal static Result_CVec_u8ZPeerHandleErrorZ constr_from_ptr(long ptr) {
15                 if (bindings.CResult_CVec_u8ZPeerHandleErrorZ_is_ok(ptr)) {
16                         return new Result_CVec_u8ZPeerHandleErrorZ_OK(null, ptr);
17                 } else {
18                         return new Result_CVec_u8ZPeerHandleErrorZ_Err(null, ptr);
19                 }
20         }
21         public class Result_CVec_u8ZPeerHandleErrorZ_OK : Result_CVec_u8ZPeerHandleErrorZ {
22                 public readonly byte[] res;
23                 internal Result_CVec_u8ZPeerHandleErrorZ_OK(object _dummy, long ptr) : base(_dummy, ptr) {
24                         long res = bindings.CResult_CVec_u8ZPeerHandleErrorZ_get_ok(ptr);
25                         byte[] res_conv = InternalUtils.decodeUint8Array(res);
26                         this.res = res_conv;
27                 }
28         }
29
30         public class Result_CVec_u8ZPeerHandleErrorZ_Err : Result_CVec_u8ZPeerHandleErrorZ {
31                 public readonly PeerHandleError err;
32                 internal Result_CVec_u8ZPeerHandleErrorZ_Err(object _dummy, long ptr) : base(_dummy, ptr) {
33                         long err = bindings.CResult_CVec_u8ZPeerHandleErrorZ_get_err(ptr);
34                         org.ldk.structs.PeerHandleError err_hu_conv = null; if (err < 0 || err > 4096) { err_hu_conv = new org.ldk.structs.PeerHandleError(null, err); }
35                         if (err_hu_conv != null) { err_hu_conv.ptrs_to.AddLast(this); };
36                         this.err = err_hu_conv;
37                 }
38         }
39
40         /**
41          * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
42          */
43         public static Result_CVec_u8ZPeerHandleErrorZ ok(byte[] o) {
44                 long ret = bindings.CResult_CVec_u8ZPeerHandleErrorZ_ok(InternalUtils.encodeUint8Array(o));
45                 GC.KeepAlive(o);
46                 if (ret >= 0 && ret <= 4096) { return null; }
47                 Result_CVec_u8ZPeerHandleErrorZ ret_hu_conv = Result_CVec_u8ZPeerHandleErrorZ.constr_from_ptr(ret);
48                 return ret_hu_conv;
49         }
50
51         /**
52          * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
53          */
54         public static Result_CVec_u8ZPeerHandleErrorZ err(org.ldk.structs.PeerHandleError e) {
55                 long ret = bindings.CResult_CVec_u8ZPeerHandleErrorZ_err(e.ptr);
56                 GC.KeepAlive(e);
57                 if (ret >= 0 && ret <= 4096) { return null; }
58                 Result_CVec_u8ZPeerHandleErrorZ ret_hu_conv = Result_CVec_u8ZPeerHandleErrorZ.constr_from_ptr(ret);
59                 return ret_hu_conv;
60         }
61
62         /**
63          * Checks if the given object is currently in the success state
64          */
65         public bool is_ok() {
66                 bool ret = bindings.CResult_CVec_u8ZPeerHandleErrorZ_is_ok(this.ptr);
67                 GC.KeepAlive(this);
68                 return ret;
69         }
70
71         internal long clone_ptr() {
72                 long ret = bindings.CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(this.ptr);
73                 GC.KeepAlive(this);
74                 return ret;
75         }
76
77         /**
78          * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
79          * but with all dynamically-allocated buffers duplicated in new buffers.
80          */
81         public Result_CVec_u8ZPeerHandleErrorZ clone() {
82                 long ret = bindings.CResult_CVec_u8ZPeerHandleErrorZ_clone(this.ptr);
83                 GC.KeepAlive(this);
84                 if (ret >= 0 && ret <= 4096) { return null; }
85                 Result_CVec_u8ZPeerHandleErrorZ ret_hu_conv = Result_CVec_u8ZPeerHandleErrorZ.constr_from_ptr(ret);
86                 return ret_hu_conv;
87         }
88
89 }
90 } } }