6 namespace org { namespace ldk { namespace structs {
9 * Quantity of items supported by an [`Offer`].
11 public class Quantity : CommonBase {
12 protected Quantity(object _dummy, long ptr) : base(ptr) { }
14 if (ptr != 0) { bindings.Quantity_free(ptr); }
17 internal static Quantity constr_from_ptr(long ptr) {
18 long raw_ty = bindings.LDKQuantity_ty_from_ptr(ptr);
20 case 0: return new Quantity_Bounded(ptr);
21 case 1: return new Quantity_Unbounded(ptr);
22 case 2: return new Quantity_One(ptr);
24 throw new ArgumentException("Impossible enum variant");
28 /** A Quantity of type Bounded */
29 public class Quantity_Bounded : Quantity {
31 internal Quantity_Bounded(long ptr) : base(null, ptr) {
32 this.bounded = bindings.LDKQuantity_Bounded_get_bounded(ptr);
35 /** A Quantity of type Unbounded */
36 public class Quantity_Unbounded : Quantity {
37 internal Quantity_Unbounded(long ptr) : base(null, ptr) {
40 /** A Quantity of type One */
41 public class Quantity_One : Quantity {
42 internal Quantity_One(long ptr) : base(null, ptr) {
45 internal long clone_ptr() {
46 long ret = bindings.Quantity_clone_ptr(this.ptr);
52 * Creates a copy of the Quantity
54 public Quantity clone() {
55 long ret = bindings.Quantity_clone(this.ptr);
57 if (ret >= 0 && ret <= 4096) { return null; }
58 org.ldk.structs.Quantity ret_hu_conv = org.ldk.structs.Quantity.constr_from_ptr(ret);
59 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
64 * Utility method to constructs a new Bounded-variant Quantity
66 public static Quantity bounded(long a) {
67 long ret = bindings.Quantity_bounded(a);
69 if (ret >= 0 && ret <= 4096) { return null; }
70 org.ldk.structs.Quantity ret_hu_conv = org.ldk.structs.Quantity.constr_from_ptr(ret);
71 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
76 * Utility method to constructs a new Unbounded-variant Quantity
78 public static Quantity unbounded() {
79 long ret = bindings.Quantity_unbounded();
80 if (ret >= 0 && ret <= 4096) { return null; }
81 org.ldk.structs.Quantity ret_hu_conv = org.ldk.structs.Quantity.constr_from_ptr(ret);
82 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
87 * Utility method to constructs a new One-variant Quantity
89 public static Quantity one() {
90 long ret = bindings.Quantity_one();
91 if (ret >= 0 && ret <= 4096) { return null; }
92 org.ldk.structs.Quantity ret_hu_conv = org.ldk.structs.Quantity.constr_from_ptr(ret);
93 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };