6 namespace org { namespace ldk { namespace structs {
13 * The description can be at most 639 __bytes__ long
15 public class Description : CommonBase {
16 internal Description(object _dummy, long ptr) : base(ptr) { }
18 if (ptr != 0) { bindings.Description_free(ptr); }
21 internal long clone_ptr() {
22 long ret = bindings.Description_clone_ptr(this.ptr);
28 * Creates a copy of the Description
30 public Description clone() {
31 long ret = bindings.Description_clone(this.ptr);
33 if (ret >= 0 && ret <= 4096) { return null; }
34 org.ldk.structs.Description ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Description(null, ret); }
35 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
40 * Generates a non-cryptographic 64-bit hash of the Description.
43 long ret = bindings.Description_hash(this.ptr);
48 public override int GetHashCode() {
49 return (int)this.hash();
52 * Checks if two Descriptions contain equal inner contents.
53 * This ignores pointers and is_owned flags and looks at the values in fields.
54 * Two objects with NULL inner values will be considered "equal" here.
56 public bool eq(org.ldk.structs.Description b) {
57 bool ret = bindings.Description_eq(this.ptr, b.ptr);
60 if (this != null) { this.ptrs_to.AddLast(b); };
64 public override bool Equals(object o) {
65 if (!(o is Description)) return false;
66 return this.eq((Description)o);
69 * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
70 * returns [`CreationError::DescriptionTooLong`] otherwise
72 * Please note that single characters may use more than one byte due to UTF8 encoding.
74 public static Result_DescriptionCreationErrorZ of(string description) {
75 long ret = bindings.Description_new(InternalUtils.encodeString(description));
76 GC.KeepAlive(description);
77 if (ret >= 0 && ret <= 4096) { return null; }
78 Result_DescriptionCreationErrorZ ret_hu_conv = Result_DescriptionCreationErrorZ.constr_from_ptr(ret);
83 * Returns the underlying description [`UntrustedString`]
85 public UntrustedString into_inner() {
86 long ret = bindings.Description_into_inner(this.ptr);
88 if (ret >= 0 && ret <= 4096) { return null; }
89 org.ldk.structs.UntrustedString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UntrustedString(null, ret); }
90 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
91 if (this != null) { this.ptrs_to.AddLast(this); };
96 * Get the string representation of a Description object
98 public string to_str() {
99 long ret = bindings.Description_to_str(this.ptr);
101 if (ret >= 0 && ret <= 4096) { return null; }
102 string ret_conv = InternalUtils.decodeString(ret);