6 namespace org { namespace ldk { namespace structs {
9 * An enum which can either contain a crate::lightning::util::events::HTLCDestination or not
11 public class Option_HTLCDestinationZ : CommonBase {
12 protected Option_HTLCDestinationZ(object _dummy, long ptr) : base(ptr) { }
13 ~Option_HTLCDestinationZ() {
14 if (ptr != 0) { bindings.COption_HTLCDestinationZ_free(ptr); }
17 internal static Option_HTLCDestinationZ constr_from_ptr(long ptr) {
18 long raw_ty = bindings.LDKCOption_HTLCDestinationZ_ty_from_ptr(ptr);
20 case 0: return new Option_HTLCDestinationZ_Some(ptr);
21 case 1: return new Option_HTLCDestinationZ_None(ptr);
23 throw new ArgumentException("Impossible enum variant");
27 /** A Option_HTLCDestinationZ of type Some */
28 public class Option_HTLCDestinationZ_Some : Option_HTLCDestinationZ {
29 public HTLCDestination some;
30 internal Option_HTLCDestinationZ_Some(long ptr) : base(null, ptr) {
31 long some = bindings.LDKCOption_HTLCDestinationZ_Some_get_some(ptr);
32 org.ldk.structs.HTLCDestination some_hu_conv = org.ldk.structs.HTLCDestination.constr_from_ptr(some);
33 if (some_hu_conv != null) { some_hu_conv.ptrs_to.AddLast(this); };
34 this.some = some_hu_conv;
37 /** A Option_HTLCDestinationZ of type None */
38 public class Option_HTLCDestinationZ_None : Option_HTLCDestinationZ {
39 internal Option_HTLCDestinationZ_None(long ptr) : base(null, ptr) {
43 * Constructs a new COption_HTLCDestinationZ containing a crate::lightning::util::events::HTLCDestination
45 public static Option_HTLCDestinationZ some(org.ldk.structs.HTLCDestination o) {
46 long ret = bindings.COption_HTLCDestinationZ_some(o.ptr);
48 if (ret >= 0 && ret <= 4096) { return null; }
49 org.ldk.structs.Option_HTLCDestinationZ ret_hu_conv = org.ldk.structs.Option_HTLCDestinationZ.constr_from_ptr(ret);
50 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
55 * Constructs a new COption_HTLCDestinationZ containing nothing
57 public static Option_HTLCDestinationZ none() {
58 long ret = bindings.COption_HTLCDestinationZ_none();
59 if (ret >= 0 && ret <= 4096) { return null; }
60 org.ldk.structs.Option_HTLCDestinationZ ret_hu_conv = org.ldk.structs.Option_HTLCDestinationZ.constr_from_ptr(ret);
61 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
65 internal long clone_ptr() {
66 long ret = bindings.COption_HTLCDestinationZ_clone_ptr(this.ptr);
72 * Creates a new COption_HTLCDestinationZ which has the same data as `orig`
73 * but with all dynamically-allocated buffers duplicated in new buffers.
75 public Option_HTLCDestinationZ clone() {
76 long ret = bindings.COption_HTLCDestinationZ_clone(this.ptr);
78 if (ret >= 0 && ret <= 4096) { return null; }
79 org.ldk.structs.Option_HTLCDestinationZ ret_hu_conv = org.ldk.structs.Option_HTLCDestinationZ.constr_from_ptr(ret);
80 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };