6 namespace org { namespace ldk { namespace structs {
9 * An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
11 public class Option_ThirtyTwoBytesZ : CommonBase {
12 protected Option_ThirtyTwoBytesZ(object _dummy, long ptr) : base(ptr) { }
13 ~Option_ThirtyTwoBytesZ() {
14 if (ptr != 0) { bindings.COption_ThirtyTwoBytesZ_free(ptr); }
17 internal static Option_ThirtyTwoBytesZ constr_from_ptr(long ptr) {
18 long raw_ty = bindings.LDKCOption_ThirtyTwoBytesZ_ty_from_ptr(ptr);
20 case 0: return new Option_ThirtyTwoBytesZ_Some(ptr);
21 case 1: return new Option_ThirtyTwoBytesZ_None(ptr);
23 throw new ArgumentException("Impossible enum variant");
27 /** A Option_ThirtyTwoBytesZ of type Some */
28 public class Option_ThirtyTwoBytesZ_Some : Option_ThirtyTwoBytesZ {
30 internal Option_ThirtyTwoBytesZ_Some(long ptr) : base(null, ptr) {
31 long some = bindings.LDKCOption_ThirtyTwoBytesZ_Some_get_some(ptr);
32 byte[] some_conv = InternalUtils.decodeUint8Array(some);
33 this.some = some_conv;
36 /** A Option_ThirtyTwoBytesZ of type None */
37 public class Option_ThirtyTwoBytesZ_None : Option_ThirtyTwoBytesZ {
38 internal Option_ThirtyTwoBytesZ_None(long ptr) : base(null, ptr) {
42 * Constructs a new COption_ThirtyTwoBytesZ containing a crate::c_types::ThirtyTwoBytes
44 public static Option_ThirtyTwoBytesZ some(byte[] o) {
45 long ret = bindings.COption_ThirtyTwoBytesZ_some(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(o, 32)));
47 if (ret >= 0 && ret <= 4096) { return null; }
48 org.ldk.structs.Option_ThirtyTwoBytesZ ret_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(ret);
49 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
54 * Constructs a new COption_ThirtyTwoBytesZ containing nothing
56 public static Option_ThirtyTwoBytesZ none() {
57 long ret = bindings.COption_ThirtyTwoBytesZ_none();
58 if (ret >= 0 && ret <= 4096) { return null; }
59 org.ldk.structs.Option_ThirtyTwoBytesZ ret_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(ret);
60 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
64 internal long clone_ptr() {
65 long ret = bindings.COption_ThirtyTwoBytesZ_clone_ptr(this.ptr);
71 * Creates a new COption_ThirtyTwoBytesZ which has the same data as `orig`
72 * but with all dynamically-allocated buffers duplicated in new buffers.
74 public Option_ThirtyTwoBytesZ clone() {
75 long ret = bindings.COption_ThirtyTwoBytesZ_clone(this.ptr);
77 if (ret >= 0 && ret <= 4096) { return null; }
78 org.ldk.structs.Option_ThirtyTwoBytesZ ret_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(ret);
79 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };