6 namespace org { namespace ldk { namespace structs {
9 * An enum which can either contain a crate::lightning::offers::offer::Amount or not
11 public class Option_AmountZ : CommonBase {
12 protected Option_AmountZ(object _dummy, long ptr) : base(ptr) { }
14 if (ptr != 0) { bindings.COption_AmountZ_free(ptr); }
17 internal static Option_AmountZ constr_from_ptr(long ptr) {
18 long raw_ty = bindings.LDKCOption_AmountZ_ty_from_ptr(ptr);
20 case 0: return new Option_AmountZ_Some(ptr);
21 case 1: return new Option_AmountZ_None(ptr);
23 throw new ArgumentException("Impossible enum variant");
27 /** A Option_AmountZ of type Some */
28 public class Option_AmountZ_Some : Option_AmountZ {
30 internal Option_AmountZ_Some(long ptr) : base(null, ptr) {
31 long some = bindings.LDKCOption_AmountZ_Some_get_some(ptr);
32 org.ldk.structs.Amount some_hu_conv = org.ldk.structs.Amount.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_AmountZ of type None */
38 public class Option_AmountZ_None : Option_AmountZ {
39 internal Option_AmountZ_None(long ptr) : base(null, ptr) {
43 * Constructs a new COption_AmountZ containing a crate::lightning::offers::offer::Amount
45 public static Option_AmountZ some(org.ldk.structs.Amount o) {
46 long ret = bindings.COption_AmountZ_some(o.ptr);
48 if (ret >= 0 && ret <= 4096) { return null; }
49 org.ldk.structs.Option_AmountZ ret_hu_conv = org.ldk.structs.Option_AmountZ.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); };
56 * Constructs a new COption_AmountZ containing nothing
58 public static Option_AmountZ none() {
59 long ret = bindings.COption_AmountZ_none();
60 if (ret >= 0 && ret <= 4096) { return null; }
61 org.ldk.structs.Option_AmountZ ret_hu_conv = org.ldk.structs.Option_AmountZ.constr_from_ptr(ret);
62 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
66 internal long clone_ptr() {
67 long ret = bindings.COption_AmountZ_clone_ptr(this.ptr);
73 * Creates a new COption_AmountZ which has the same data as `orig`
74 * but with all dynamically-allocated buffers duplicated in new buffers.
76 public Option_AmountZ clone() {
77 long ret = bindings.COption_AmountZ_clone(this.ptr);
79 if (ret >= 0 && ret <= 4096) { return null; }
80 org.ldk.structs.Option_AmountZ ret_hu_conv = org.ldk.structs.Option_AmountZ.constr_from_ptr(ret);
81 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };