[C#] Run tests against release library in determinism CI run
[ldk-java] / c_sharp / src / org / ldk / structs / Option_TypeZ.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 /**
9  * An enum which can either contain a crate::lightning::ln::wire::Type or not
10  */
11 public class Option_TypeZ : CommonBase {
12         protected Option_TypeZ(object _dummy, long ptr) : base(ptr) { }
13         ~Option_TypeZ() {
14                 if (ptr != 0) { bindings.COption_TypeZ_free(ptr); }
15         }
16
17         internal static Option_TypeZ constr_from_ptr(long ptr) {
18                 long raw_ty = bindings.LDKCOption_TypeZ_ty_from_ptr(ptr);
19                 switch (raw_ty) {
20                         case 0: return new Option_TypeZ_Some(ptr);
21                         case 1: return new Option_TypeZ_None(ptr);
22                         default:
23                                 throw new ArgumentException("Impossible enum variant");
24                 }
25         }
26
27         /** A Option_TypeZ of type Some */
28         public class Option_TypeZ_Some : Option_TypeZ {
29                 public Type some;
30                 internal Option_TypeZ_Some(long ptr) : base(null, ptr) {
31                         long some = bindings.LDKCOption_TypeZ_Some_get_some(ptr);
32                         Type ret_hu_conv = new Type(null, some);
33                         if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
34                         this.some = ret_hu_conv;
35                 }
36         }
37         /** A Option_TypeZ of type None */
38         public class Option_TypeZ_None : Option_TypeZ {
39                 internal Option_TypeZ_None(long ptr) : base(null, ptr) {
40                 }
41         }
42         /**
43          * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
44          */
45         public static Option_TypeZ some(org.ldk.structs.Type o) {
46                 long ret = bindings.COption_TypeZ_some(o.ptr);
47                 GC.KeepAlive(o);
48                 if (ret >= 0 && ret <= 4096) { return null; }
49                 org.ldk.structs.Option_TypeZ ret_hu_conv = org.ldk.structs.Option_TypeZ.constr_from_ptr(ret);
50                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
51                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(o); };
52                 return ret_hu_conv;
53         }
54
55         /**
56          * Constructs a new COption_TypeZ containing nothing
57          */
58         public static Option_TypeZ none() {
59                 long ret = bindings.COption_TypeZ_none();
60                 if (ret >= 0 && ret <= 4096) { return null; }
61                 org.ldk.structs.Option_TypeZ ret_hu_conv = org.ldk.structs.Option_TypeZ.constr_from_ptr(ret);
62                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
63                 return ret_hu_conv;
64         }
65
66         internal long clone_ptr() {
67                 long ret = bindings.COption_TypeZ_clone_ptr(this.ptr);
68                 GC.KeepAlive(this);
69                 return ret;
70         }
71
72         /**
73          * Creates a new COption_TypeZ which has the same data as `orig`
74          * but with all dynamically-allocated buffers duplicated in new buffers.
75          */
76         public Option_TypeZ clone() {
77                 long ret = bindings.COption_TypeZ_clone(this.ptr);
78                 GC.KeepAlive(this);
79                 if (ret >= 0 && ret <= 4096) { return null; }
80                 org.ldk.structs.Option_TypeZ ret_hu_conv = org.ldk.structs.Option_TypeZ.constr_from_ptr(ret);
81                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
82                 return ret_hu_conv;
83         }
84
85 }
86 } } }