6 namespace org { namespace ldk { namespace structs {
9 * An enum which can either contain a crate::c_types::Str or not
11 public class Option_StrZ : CommonBase {
12 protected Option_StrZ(object _dummy, long ptr) : base(ptr) { }
14 if (ptr != 0) { bindings.COption_StrZ_free(ptr); }
17 internal static Option_StrZ constr_from_ptr(long ptr) {
18 long raw_ty = bindings.LDKCOption_StrZ_ty_from_ptr(ptr);
20 case 0: return new Option_StrZ_Some(ptr);
21 case 1: return new Option_StrZ_None(ptr);
23 throw new ArgumentException("Impossible enum variant");
27 /** A Option_StrZ of type Some */
28 public class Option_StrZ_Some : Option_StrZ {
30 internal Option_StrZ_Some(long ptr) : base(null, ptr) {
31 long some = bindings.LDKCOption_StrZ_Some_get_some(ptr);
32 string some_conv = InternalUtils.decodeString(some);
33 this.some = some_conv;
36 /** A Option_StrZ of type None */
37 public class Option_StrZ_None : Option_StrZ {
38 internal Option_StrZ_None(long ptr) : base(null, ptr) {
42 * Constructs a new COption_StrZ containing a crate::c_types::Str
44 public static Option_StrZ some(string o) {
45 long ret = bindings.COption_StrZ_some(InternalUtils.encodeString(o));
47 if (ret >= 0 && ret <= 4096) { return null; }
48 org.ldk.structs.Option_StrZ ret_hu_conv = org.ldk.structs.Option_StrZ.constr_from_ptr(ret);
49 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
54 * Constructs a new COption_StrZ containing nothing
56 public static Option_StrZ none() {
57 long ret = bindings.COption_StrZ_none();
58 if (ret >= 0 && ret <= 4096) { return null; }
59 org.ldk.structs.Option_StrZ ret_hu_conv = org.ldk.structs.Option_StrZ.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_StrZ_clone_ptr(this.ptr);
71 * Creates a new COption_StrZ which has the same data as `orig`
72 * but with all dynamically-allocated buffers duplicated in new buffers.
74 public Option_StrZ clone() {
75 long ret = bindings.COption_StrZ_clone(this.ptr);
77 if (ret >= 0 && ret <= 4096) { return null; }
78 org.ldk.structs.Option_StrZ ret_hu_conv = org.ldk.structs.Option_StrZ.constr_from_ptr(ret);
79 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };