]> git.bitcoin.ninja Git - rust-lightning/commitdiff
- bindings updates
authorMatt Corallo <git@bluematt.me>
Thu, 11 Feb 2021 17:29:45 +0000 (12:29 -0500)
committerMatt Corallo <git@bluematt.me>
Thu, 11 Feb 2021 21:19:41 +0000 (16:19 -0500)
lightning-c-bindings/include/lightning.h
lightning-c-bindings/include/lightningpp.hpp
lightning-c-bindings/src/c_types/derived.rs
lightning-c-bindings/src/ln/channelmanager.rs
lightning-c-bindings/src/ln/features.rs

index a1b2258b9ca94ee31e67a720b22e3cdf29a4892d..6c823d4cd569b2a4638ffc69129c79762a4d33a4 100644 (file)
@@ -595,6 +595,78 @@ typedef struct LDKCResult_boolPeerHandleErrorZ {
 
 
 
+/**
+ * Features used within an `init` message.
+ */
+typedef struct MUST_USE_STRUCT LDKInitFeatures {
+   /**
+    * Nearly everywhere, inner must be non-null, however in places where
+    * the Rust equivalent takes an Option, it may be set to null to indicate None.
+    */
+   LDKnativeInitFeatures *inner;
+   bool is_owned;
+} LDKInitFeatures;
+
+typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
+   struct LDKInitFeatures *result;
+   struct LDKDecodeError *err;
+} LDKCResult_InitFeaturesDecodeErrorZPtr;
+
+typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
+   union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
+   bool result_ok;
+} LDKCResult_InitFeaturesDecodeErrorZ;
+
+
+
+/**
+ * Features used within a `node_announcement` message.
+ */
+typedef struct MUST_USE_STRUCT LDKNodeFeatures {
+   /**
+    * Nearly everywhere, inner must be non-null, however in places where
+    * the Rust equivalent takes an Option, it may be set to null to indicate None.
+    */
+   LDKnativeNodeFeatures *inner;
+   bool is_owned;
+} LDKNodeFeatures;
+
+typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
+   struct LDKNodeFeatures *result;
+   struct LDKDecodeError *err;
+} LDKCResult_NodeFeaturesDecodeErrorZPtr;
+
+typedef struct LDKCResult_NodeFeaturesDecodeErrorZ {
+   union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
+   bool result_ok;
+} LDKCResult_NodeFeaturesDecodeErrorZ;
+
+
+
+/**
+ * Features used within a `channel_announcement` message.
+ */
+typedef struct MUST_USE_STRUCT LDKChannelFeatures {
+   /**
+    * Nearly everywhere, inner must be non-null, however in places where
+    * the Rust equivalent takes an Option, it may be set to null to indicate None.
+    */
+   LDKnativeChannelFeatures *inner;
+   bool is_owned;
+} LDKChannelFeatures;
+
+typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
+   struct LDKChannelFeatures *result;
+   struct LDKDecodeError *err;
+} LDKCResult_ChannelFeaturesDecodeErrorZPtr;
+
+typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ {
+   union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
+   bool result_ok;
+} LDKCResult_ChannelFeaturesDecodeErrorZ;
+
+
+
 /**
  * Options which apply on a per-channel basis and may change at runtime or based on negotiation
  * with our counterparty.
@@ -3388,20 +3460,6 @@ typedef struct MUST_USE_STRUCT LDKKeysManager {
    bool is_owned;
 } LDKKeysManager;
 
-
-
-/**
- * Features used within an `init` message.
- */
-typedef struct MUST_USE_STRUCT LDKInitFeatures {
-   /**
-    * Nearly everywhere, inner must be non-null, however in places where
-    * the Rust equivalent takes an Option, it may be set to null to indicate None.
-    */
-   LDKnativeInitFeatures *inner;
-   bool is_owned;
-} LDKInitFeatures;
-
 typedef struct LDKThreeBytes {
    uint8_t data[3];
 } LDKThreeBytes;
@@ -3541,34 +3599,6 @@ typedef struct MUST_USE_STRUCT LDKDataLossProtect {
    bool is_owned;
 } LDKDataLossProtect;
 
-
-
-/**
- * Features used within a `node_announcement` message.
- */
-typedef struct MUST_USE_STRUCT LDKNodeFeatures {
-   /**
-    * Nearly everywhere, inner must be non-null, however in places where
-    * the Rust equivalent takes an Option, it may be set to null to indicate None.
-    */
-   LDKnativeNodeFeatures *inner;
-   bool is_owned;
-} LDKNodeFeatures;
-
-
-
-/**
- * Features used within a `channel_announcement` message.
- */
-typedef struct MUST_USE_STRUCT LDKChannelFeatures {
-   /**
-    * Nearly everywhere, inner must be non-null, however in places where
-    * the Rust equivalent takes an Option, it may be set to null to indicate None.
-    */
-   LDKnativeChannelFeatures *inner;
-   bool is_owned;
-} LDKChannelFeatures;
-
 /**
  * A trait to describe an object which can receive routing messages.
  *
@@ -3916,6 +3946,24 @@ void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _r
 
 struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
 
+struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
+
+struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
+
+void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
+
+struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
+
+struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
+
+void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
+
+struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
+
+struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
+
+void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
+
 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
 
 struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
@@ -8184,6 +8232,54 @@ void NodeFeatures_free(struct LDKNodeFeatures this_ptr);
 
 void ChannelFeatures_free(struct LDKChannelFeatures this_ptr);
 
+/**
+ * Create a blank Features with no features set
+ */
+MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void);
+
+/**
+ * Creates features known by the implementation as defined by [`T::KNOWN_FEATURE_FLAGS`].
+ *
+ * [`T::KNOWN_FEATURE_FLAGS`]: sealed/trait.Context.html#associatedconstant.KNOWN_FEATURE_FLAGS
+ */
+MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
+
+/**
+ * Create a blank Features with no features set
+ */
+MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
+
+/**
+ * Creates features known by the implementation as defined by [`T::KNOWN_FEATURE_FLAGS`].
+ *
+ * [`T::KNOWN_FEATURE_FLAGS`]: sealed/trait.Context.html#associatedconstant.KNOWN_FEATURE_FLAGS
+ */
+MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
+
+/**
+ * Create a blank Features with no features set
+ */
+MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
+
+/**
+ * Creates features known by the implementation as defined by [`T::KNOWN_FEATURE_FLAGS`].
+ *
+ * [`T::KNOWN_FEATURE_FLAGS`]: sealed/trait.Context.html#associatedconstant.KNOWN_FEATURE_FLAGS
+ */
+MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
+
+struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj);
+
+struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj);
+
+struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj);
+
+struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser);
+
+struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser);
+
+struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser);
+
 void RouteHop_free(struct LDKRouteHop this_ptr);
 
 /**
index 4b608fc1c223a4a8ad8b41c55ac05447304b48b7..06968902b3e5631bc25ea4724126bfa21a7b48de 100644 (file)
@@ -1961,6 +1961,21 @@ public:
        const LDKCResult_NonePeerHandleErrorZ* operator &() const { return &self; }
        const LDKCResult_NonePeerHandleErrorZ* operator ->() const { return &self; }
 };
+class CResult_InitFeaturesDecodeErrorZ {
+private:
+       LDKCResult_InitFeaturesDecodeErrorZ self;
+public:
+       CResult_InitFeaturesDecodeErrorZ(const CResult_InitFeaturesDecodeErrorZ&) = delete;
+       CResult_InitFeaturesDecodeErrorZ(CResult_InitFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InitFeaturesDecodeErrorZ)); }
+       CResult_InitFeaturesDecodeErrorZ(LDKCResult_InitFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InitFeaturesDecodeErrorZ)); }
+       operator LDKCResult_InitFeaturesDecodeErrorZ() && { LDKCResult_InitFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InitFeaturesDecodeErrorZ)); return res; }
+       ~CResult_InitFeaturesDecodeErrorZ() { CResult_InitFeaturesDecodeErrorZ_free(self); }
+       CResult_InitFeaturesDecodeErrorZ& operator=(CResult_InitFeaturesDecodeErrorZ&& o) { CResult_InitFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InitFeaturesDecodeErrorZ)); return *this; }
+       LDKCResult_InitFeaturesDecodeErrorZ* operator &() { return &self; }
+       LDKCResult_InitFeaturesDecodeErrorZ* operator ->() { return &self; }
+       const LDKCResult_InitFeaturesDecodeErrorZ* operator &() const { return &self; }
+       const LDKCResult_InitFeaturesDecodeErrorZ* operator ->() const { return &self; }
+};
 class CResult_NoneLightningErrorZ {
 private:
        LDKCResult_NoneLightningErrorZ self;
@@ -2141,21 +2156,6 @@ public:
        const LDKCResult_SecretKeyErrorZ* operator &() const { return &self; }
        const LDKCResult_SecretKeyErrorZ* operator ->() const { return &self; }
 };
-class CResult_NoneAPIErrorZ {
-private:
-       LDKCResult_NoneAPIErrorZ self;
-public:
-       CResult_NoneAPIErrorZ(const CResult_NoneAPIErrorZ&) = delete;
-       CResult_NoneAPIErrorZ(CResult_NoneAPIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneAPIErrorZ)); }
-       CResult_NoneAPIErrorZ(LDKCResult_NoneAPIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneAPIErrorZ)); }
-       operator LDKCResult_NoneAPIErrorZ() && { LDKCResult_NoneAPIErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneAPIErrorZ)); return res; }
-       ~CResult_NoneAPIErrorZ() { CResult_NoneAPIErrorZ_free(self); }
-       CResult_NoneAPIErrorZ& operator=(CResult_NoneAPIErrorZ&& o) { CResult_NoneAPIErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneAPIErrorZ)); return *this; }
-       LDKCResult_NoneAPIErrorZ* operator &() { return &self; }
-       LDKCResult_NoneAPIErrorZ* operator ->() { return &self; }
-       const LDKCResult_NoneAPIErrorZ* operator &() const { return &self; }
-       const LDKCResult_NoneAPIErrorZ* operator ->() const { return &self; }
-};
 class CResult_CounterpartyChannelTransactionParametersDecodeErrorZ {
 private:
        LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ self;
@@ -2171,6 +2171,21 @@ public:
        const LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* operator &() const { return &self; }
        const LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* operator ->() const { return &self; }
 };
+class CResult_NoneAPIErrorZ {
+private:
+       LDKCResult_NoneAPIErrorZ self;
+public:
+       CResult_NoneAPIErrorZ(const CResult_NoneAPIErrorZ&) = delete;
+       CResult_NoneAPIErrorZ(CResult_NoneAPIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneAPIErrorZ)); }
+       CResult_NoneAPIErrorZ(LDKCResult_NoneAPIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneAPIErrorZ)); }
+       operator LDKCResult_NoneAPIErrorZ() && { LDKCResult_NoneAPIErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneAPIErrorZ)); return res; }
+       ~CResult_NoneAPIErrorZ() { CResult_NoneAPIErrorZ_free(self); }
+       CResult_NoneAPIErrorZ& operator=(CResult_NoneAPIErrorZ&& o) { CResult_NoneAPIErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneAPIErrorZ)); return *this; }
+       LDKCResult_NoneAPIErrorZ* operator &() { return &self; }
+       LDKCResult_NoneAPIErrorZ* operator ->() { return &self; }
+       const LDKCResult_NoneAPIErrorZ* operator &() const { return &self; }
+       const LDKCResult_NoneAPIErrorZ* operator ->() const { return &self; }
+};
 class CVec_NetAddressZ {
 private:
        LDKCVec_NetAddressZ self;
@@ -2186,6 +2201,21 @@ public:
        const LDKCVec_NetAddressZ* operator &() const { return &self; }
        const LDKCVec_NetAddressZ* operator ->() const { return &self; }
 };
+class CVec_TransactionZ {
+private:
+       LDKCVec_TransactionZ self;
+public:
+       CVec_TransactionZ(const CVec_TransactionZ&) = delete;
+       CVec_TransactionZ(CVec_TransactionZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_TransactionZ)); }
+       CVec_TransactionZ(LDKCVec_TransactionZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_TransactionZ)); }
+       operator LDKCVec_TransactionZ() && { LDKCVec_TransactionZ res = self; memset(&self, 0, sizeof(LDKCVec_TransactionZ)); return res; }
+       ~CVec_TransactionZ() { CVec_TransactionZ_free(self); }
+       CVec_TransactionZ& operator=(CVec_TransactionZ&& o) { CVec_TransactionZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_TransactionZ)); return *this; }
+       LDKCVec_TransactionZ* operator &() { return &self; }
+       LDKCVec_TransactionZ* operator ->() { return &self; }
+       const LDKCVec_TransactionZ* operator &() const { return &self; }
+       const LDKCVec_TransactionZ* operator ->() const { return &self; }
+};
 class CResult_TxCreationKeysDecodeErrorZ {
 private:
        LDKCResult_TxCreationKeysDecodeErrorZ self;
@@ -2216,6 +2246,21 @@ public:
        const LDKCVec_PublicKeyZ* operator &() const { return &self; }
        const LDKCVec_PublicKeyZ* operator ->() const { return &self; }
 };
+class CResult_ChannelFeaturesDecodeErrorZ {
+private:
+       LDKCResult_ChannelFeaturesDecodeErrorZ self;
+public:
+       CResult_ChannelFeaturesDecodeErrorZ(const CResult_ChannelFeaturesDecodeErrorZ&) = delete;
+       CResult_ChannelFeaturesDecodeErrorZ(CResult_ChannelFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelFeaturesDecodeErrorZ)); }
+       CResult_ChannelFeaturesDecodeErrorZ(LDKCResult_ChannelFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ)); }
+       operator LDKCResult_ChannelFeaturesDecodeErrorZ() && { LDKCResult_ChannelFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ)); return res; }
+       ~CResult_ChannelFeaturesDecodeErrorZ() { CResult_ChannelFeaturesDecodeErrorZ_free(self); }
+       CResult_ChannelFeaturesDecodeErrorZ& operator=(CResult_ChannelFeaturesDecodeErrorZ&& o) { CResult_ChannelFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelFeaturesDecodeErrorZ)); return *this; }
+       LDKCResult_ChannelFeaturesDecodeErrorZ* operator &() { return &self; }
+       LDKCResult_ChannelFeaturesDecodeErrorZ* operator ->() { return &self; }
+       const LDKCResult_ChannelFeaturesDecodeErrorZ* operator &() const { return &self; }
+       const LDKCResult_ChannelFeaturesDecodeErrorZ* operator ->() const { return &self; }
+};
 class C2Tuple_usizeTransactionZ {
 private:
        LDKC2Tuple_usizeTransactionZ self;
@@ -2246,21 +2291,6 @@ public:
        const LDKCVec_C2Tuple_usizeTransactionZZ* operator &() const { return &self; }
        const LDKCVec_C2Tuple_usizeTransactionZZ* operator ->() const { return &self; }
 };
-class CVec_TransactionZ {
-private:
-       LDKCVec_TransactionZ self;
-public:
-       CVec_TransactionZ(const CVec_TransactionZ&) = delete;
-       CVec_TransactionZ(CVec_TransactionZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_TransactionZ)); }
-       CVec_TransactionZ(LDKCVec_TransactionZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_TransactionZ)); }
-       operator LDKCVec_TransactionZ() && { LDKCVec_TransactionZ res = self; memset(&self, 0, sizeof(LDKCVec_TransactionZ)); return res; }
-       ~CVec_TransactionZ() { CVec_TransactionZ_free(self); }
-       CVec_TransactionZ& operator=(CVec_TransactionZ&& o) { CVec_TransactionZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_TransactionZ)); return *this; }
-       LDKCVec_TransactionZ* operator &() { return &self; }
-       LDKCVec_TransactionZ* operator ->() { return &self; }
-       const LDKCVec_TransactionZ* operator &() const { return &self; }
-       const LDKCVec_TransactionZ* operator ->() const { return &self; }
-};
 class CVec_ChannelMonitorZ {
 private:
        LDKCVec_ChannelMonitorZ self;
@@ -2291,21 +2321,6 @@ public:
        const LDKC2Tuple_u64u64Z* operator &() const { return &self; }
        const LDKC2Tuple_u64u64Z* operator ->() const { return &self; }
 };
-class CResult_UpdateFeeDecodeErrorZ {
-private:
-       LDKCResult_UpdateFeeDecodeErrorZ self;
-public:
-       CResult_UpdateFeeDecodeErrorZ(const CResult_UpdateFeeDecodeErrorZ&) = delete;
-       CResult_UpdateFeeDecodeErrorZ(CResult_UpdateFeeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UpdateFeeDecodeErrorZ)); }
-       CResult_UpdateFeeDecodeErrorZ(LDKCResult_UpdateFeeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UpdateFeeDecodeErrorZ)); }
-       operator LDKCResult_UpdateFeeDecodeErrorZ() && { LDKCResult_UpdateFeeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UpdateFeeDecodeErrorZ)); return res; }
-       ~CResult_UpdateFeeDecodeErrorZ() { CResult_UpdateFeeDecodeErrorZ_free(self); }
-       CResult_UpdateFeeDecodeErrorZ& operator=(CResult_UpdateFeeDecodeErrorZ&& o) { CResult_UpdateFeeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UpdateFeeDecodeErrorZ)); return *this; }
-       LDKCResult_UpdateFeeDecodeErrorZ* operator &() { return &self; }
-       LDKCResult_UpdateFeeDecodeErrorZ* operator ->() { return &self; }
-       const LDKCResult_UpdateFeeDecodeErrorZ* operator &() const { return &self; }
-       const LDKCResult_UpdateFeeDecodeErrorZ* operator ->() const { return &self; }
-};
 class CResult_DirectionalChannelInfoDecodeErrorZ {
 private:
        LDKCResult_DirectionalChannelInfoDecodeErrorZ self;
@@ -2321,20 +2336,20 @@ public:
        const LDKCResult_DirectionalChannelInfoDecodeErrorZ* operator &() const { return &self; }
        const LDKCResult_DirectionalChannelInfoDecodeErrorZ* operator ->() const { return &self; }
 };
-class CResult_NodeAnnouncementDecodeErrorZ {
+class CResult_UpdateFeeDecodeErrorZ {
 private:
-       LDKCResult_NodeAnnouncementDecodeErrorZ self;
+       LDKCResult_UpdateFeeDecodeErrorZ self;
 public:
-       CResult_NodeAnnouncementDecodeErrorZ(const CResult_NodeAnnouncementDecodeErrorZ&) = delete;
-       CResult_NodeAnnouncementDecodeErrorZ(CResult_NodeAnnouncementDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeAnnouncementDecodeErrorZ)); }
-       CResult_NodeAnnouncementDecodeErrorZ(LDKCResult_NodeAnnouncementDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ)); }
-       operator LDKCResult_NodeAnnouncementDecodeErrorZ() && { LDKCResult_NodeAnnouncementDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ)); return res; }
-       ~CResult_NodeAnnouncementDecodeErrorZ() { CResult_NodeAnnouncementDecodeErrorZ_free(self); }
-       CResult_NodeAnnouncementDecodeErrorZ& operator=(CResult_NodeAnnouncementDecodeErrorZ&& o) { CResult_NodeAnnouncementDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeAnnouncementDecodeErrorZ)); return *this; }
-       LDKCResult_NodeAnnouncementDecodeErrorZ* operator &() { return &self; }
-       LDKCResult_NodeAnnouncementDecodeErrorZ* operator ->() { return &self; }
-       const LDKCResult_NodeAnnouncementDecodeErrorZ* operator &() const { return &self; }
-       const LDKCResult_NodeAnnouncementDecodeErrorZ* operator ->() const { return &self; }
+       CResult_UpdateFeeDecodeErrorZ(const CResult_UpdateFeeDecodeErrorZ&) = delete;
+       CResult_UpdateFeeDecodeErrorZ(CResult_UpdateFeeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UpdateFeeDecodeErrorZ)); }
+       CResult_UpdateFeeDecodeErrorZ(LDKCResult_UpdateFeeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UpdateFeeDecodeErrorZ)); }
+       operator LDKCResult_UpdateFeeDecodeErrorZ() && { LDKCResult_UpdateFeeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UpdateFeeDecodeErrorZ)); return res; }
+       ~CResult_UpdateFeeDecodeErrorZ() { CResult_UpdateFeeDecodeErrorZ_free(self); }
+       CResult_UpdateFeeDecodeErrorZ& operator=(CResult_UpdateFeeDecodeErrorZ&& o) { CResult_UpdateFeeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UpdateFeeDecodeErrorZ)); return *this; }
+       LDKCResult_UpdateFeeDecodeErrorZ* operator &() { return &self; }
+       LDKCResult_UpdateFeeDecodeErrorZ* operator ->() { return &self; }
+       const LDKCResult_UpdateFeeDecodeErrorZ* operator &() const { return &self; }
+       const LDKCResult_UpdateFeeDecodeErrorZ* operator ->() const { return &self; }
 };
 class C2Tuple_u32TxOutZ {
 private:
@@ -2351,6 +2366,21 @@ public:
        const LDKC2Tuple_u32TxOutZ* operator &() const { return &self; }
        const LDKC2Tuple_u32TxOutZ* operator ->() const { return &self; }
 };
+class CResult_NodeAnnouncementDecodeErrorZ {
+private:
+       LDKCResult_NodeAnnouncementDecodeErrorZ self;
+public:
+       CResult_NodeAnnouncementDecodeErrorZ(const CResult_NodeAnnouncementDecodeErrorZ&) = delete;
+       CResult_NodeAnnouncementDecodeErrorZ(CResult_NodeAnnouncementDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeAnnouncementDecodeErrorZ)); }
+       CResult_NodeAnnouncementDecodeErrorZ(LDKCResult_NodeAnnouncementDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ)); }
+       operator LDKCResult_NodeAnnouncementDecodeErrorZ() && { LDKCResult_NodeAnnouncementDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ)); return res; }
+       ~CResult_NodeAnnouncementDecodeErrorZ() { CResult_NodeAnnouncementDecodeErrorZ_free(self); }
+       CResult_NodeAnnouncementDecodeErrorZ& operator=(CResult_NodeAnnouncementDecodeErrorZ&& o) { CResult_NodeAnnouncementDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeAnnouncementDecodeErrorZ)); return *this; }
+       LDKCResult_NodeAnnouncementDecodeErrorZ* operator &() { return &self; }
+       LDKCResult_NodeAnnouncementDecodeErrorZ* operator ->() { return &self; }
+       const LDKCResult_NodeAnnouncementDecodeErrorZ* operator &() const { return &self; }
+       const LDKCResult_NodeAnnouncementDecodeErrorZ* operator ->() const { return &self; }
+};
 class CResult_QueryChannelRangeDecodeErrorZ {
 private:
        LDKCResult_QueryChannelRangeDecodeErrorZ self;
@@ -2906,6 +2936,21 @@ public:
        const LDKCResult_InitDecodeErrorZ* operator &() const { return &self; }
        const LDKCResult_InitDecodeErrorZ* operator ->() const { return &self; }
 };
+class CResult_NodeFeaturesDecodeErrorZ {
+private:
+       LDKCResult_NodeFeaturesDecodeErrorZ self;
+public:
+       CResult_NodeFeaturesDecodeErrorZ(const CResult_NodeFeaturesDecodeErrorZ&) = delete;
+       CResult_NodeFeaturesDecodeErrorZ(CResult_NodeFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeFeaturesDecodeErrorZ)); }
+       CResult_NodeFeaturesDecodeErrorZ(LDKCResult_NodeFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeFeaturesDecodeErrorZ)); }
+       operator LDKCResult_NodeFeaturesDecodeErrorZ() && { LDKCResult_NodeFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeFeaturesDecodeErrorZ)); return res; }
+       ~CResult_NodeFeaturesDecodeErrorZ() { CResult_NodeFeaturesDecodeErrorZ_free(self); }
+       CResult_NodeFeaturesDecodeErrorZ& operator=(CResult_NodeFeaturesDecodeErrorZ&& o) { CResult_NodeFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeFeaturesDecodeErrorZ)); return *this; }
+       LDKCResult_NodeFeaturesDecodeErrorZ* operator &() { return &self; }
+       LDKCResult_NodeFeaturesDecodeErrorZ* operator ->() { return &self; }
+       const LDKCResult_NodeFeaturesDecodeErrorZ* operator &() const { return &self; }
+       const LDKCResult_NodeFeaturesDecodeErrorZ* operator ->() const { return &self; }
+};
 class CResult_UpdateFulfillHTLCDecodeErrorZ {
 private:
        LDKCResult_UpdateFulfillHTLCDecodeErrorZ self;
index b97dcc899ddc46fa13076c87dedbc10dbee4cec2..d76374ae64c2631fc6991aa80e99116951d8f309 100644 (file)
@@ -1245,6 +1245,186 @@ impl Clone for CResult_boolPeerHandleErrorZ {
 #[no_mangle]
 pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { orig.clone() }
 #[repr(C)]
+pub union CResult_InitFeaturesDecodeErrorZPtr {
+       pub result: *mut crate::ln::features::InitFeatures,
+       pub err: *mut crate::ln::msgs::DecodeError,
+}
+#[repr(C)]
+pub struct CResult_InitFeaturesDecodeErrorZ {
+       pub contents: CResult_InitFeaturesDecodeErrorZPtr,
+       pub result_ok: bool,
+}
+#[no_mangle]
+pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::ln::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ {
+       CResult_InitFeaturesDecodeErrorZ {
+               contents: CResult_InitFeaturesDecodeErrorZPtr {
+                       result: Box::into_raw(Box::new(o)),
+               },
+               result_ok: true,
+       }
+}
+#[no_mangle]
+pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ {
+       CResult_InitFeaturesDecodeErrorZ {
+               contents: CResult_InitFeaturesDecodeErrorZPtr {
+                       err: Box::into_raw(Box::new(e)),
+               },
+               result_ok: false,
+       }
+}
+#[no_mangle]
+pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { }
+impl Drop for CResult_InitFeaturesDecodeErrorZ {
+       fn drop(&mut self) {
+               if self.result_ok {
+                       if unsafe { !(self.contents.result as *mut ()).is_null() } {
+                               let _ = unsafe { Box::from_raw(self.contents.result) };
+                       }
+               } else {
+                       if unsafe { !(self.contents.err as *mut ()).is_null() } {
+                               let _ = unsafe { Box::from_raw(self.contents.err) };
+                       }
+               }
+       }
+}
+impl From<crate::c_types::CResultTempl<crate::ln::features::InitFeatures, crate::ln::msgs::DecodeError>> for CResult_InitFeaturesDecodeErrorZ {
+       fn from(mut o: crate::c_types::CResultTempl<crate::ln::features::InitFeatures, crate::ln::msgs::DecodeError>) -> Self {
+               let contents = if o.result_ok {
+                       let result = unsafe { o.contents.result };
+                       unsafe { o.contents.result = std::ptr::null_mut() };
+                       CResult_InitFeaturesDecodeErrorZPtr { result }
+               } else {
+                       let err = unsafe { o.contents.err };
+                       unsafe { o.contents.err = std::ptr::null_mut(); }
+                       CResult_InitFeaturesDecodeErrorZPtr { err }
+               };
+               Self {
+                       contents,
+                       result_ok: o.result_ok,
+               }
+       }
+}
+#[repr(C)]
+pub union CResult_NodeFeaturesDecodeErrorZPtr {
+       pub result: *mut crate::ln::features::NodeFeatures,
+       pub err: *mut crate::ln::msgs::DecodeError,
+}
+#[repr(C)]
+pub struct CResult_NodeFeaturesDecodeErrorZ {
+       pub contents: CResult_NodeFeaturesDecodeErrorZPtr,
+       pub result_ok: bool,
+}
+#[no_mangle]
+pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::ln::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ {
+       CResult_NodeFeaturesDecodeErrorZ {
+               contents: CResult_NodeFeaturesDecodeErrorZPtr {
+                       result: Box::into_raw(Box::new(o)),
+               },
+               result_ok: true,
+       }
+}
+#[no_mangle]
+pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ {
+       CResult_NodeFeaturesDecodeErrorZ {
+               contents: CResult_NodeFeaturesDecodeErrorZPtr {
+                       err: Box::into_raw(Box::new(e)),
+               },
+               result_ok: false,
+       }
+}
+#[no_mangle]
+pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { }
+impl Drop for CResult_NodeFeaturesDecodeErrorZ {
+       fn drop(&mut self) {
+               if self.result_ok {
+                       if unsafe { !(self.contents.result as *mut ()).is_null() } {
+                               let _ = unsafe { Box::from_raw(self.contents.result) };
+                       }
+               } else {
+                       if unsafe { !(self.contents.err as *mut ()).is_null() } {
+                               let _ = unsafe { Box::from_raw(self.contents.err) };
+                       }
+               }
+       }
+}
+impl From<crate::c_types::CResultTempl<crate::ln::features::NodeFeatures, crate::ln::msgs::DecodeError>> for CResult_NodeFeaturesDecodeErrorZ {
+       fn from(mut o: crate::c_types::CResultTempl<crate::ln::features::NodeFeatures, crate::ln::msgs::DecodeError>) -> Self {
+               let contents = if o.result_ok {
+                       let result = unsafe { o.contents.result };
+                       unsafe { o.contents.result = std::ptr::null_mut() };
+                       CResult_NodeFeaturesDecodeErrorZPtr { result }
+               } else {
+                       let err = unsafe { o.contents.err };
+                       unsafe { o.contents.err = std::ptr::null_mut(); }
+                       CResult_NodeFeaturesDecodeErrorZPtr { err }
+               };
+               Self {
+                       contents,
+                       result_ok: o.result_ok,
+               }
+       }
+}
+#[repr(C)]
+pub union CResult_ChannelFeaturesDecodeErrorZPtr {
+       pub result: *mut crate::ln::features::ChannelFeatures,
+       pub err: *mut crate::ln::msgs::DecodeError,
+}
+#[repr(C)]
+pub struct CResult_ChannelFeaturesDecodeErrorZ {
+       pub contents: CResult_ChannelFeaturesDecodeErrorZPtr,
+       pub result_ok: bool,
+}
+#[no_mangle]
+pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::ln::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ {
+       CResult_ChannelFeaturesDecodeErrorZ {
+               contents: CResult_ChannelFeaturesDecodeErrorZPtr {
+                       result: Box::into_raw(Box::new(o)),
+               },
+               result_ok: true,
+       }
+}
+#[no_mangle]
+pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ {
+       CResult_ChannelFeaturesDecodeErrorZ {
+               contents: CResult_ChannelFeaturesDecodeErrorZPtr {
+                       err: Box::into_raw(Box::new(e)),
+               },
+               result_ok: false,
+       }
+}
+#[no_mangle]
+pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { }
+impl Drop for CResult_ChannelFeaturesDecodeErrorZ {
+       fn drop(&mut self) {
+               if self.result_ok {
+                       if unsafe { !(self.contents.result as *mut ()).is_null() } {
+                               let _ = unsafe { Box::from_raw(self.contents.result) };
+                       }
+               } else {
+                       if unsafe { !(self.contents.err as *mut ()).is_null() } {
+                               let _ = unsafe { Box::from_raw(self.contents.err) };
+                       }
+               }
+       }
+}
+impl From<crate::c_types::CResultTempl<crate::ln::features::ChannelFeatures, crate::ln::msgs::DecodeError>> for CResult_ChannelFeaturesDecodeErrorZ {
+       fn from(mut o: crate::c_types::CResultTempl<crate::ln::features::ChannelFeatures, crate::ln::msgs::DecodeError>) -> Self {
+               let contents = if o.result_ok {
+                       let result = unsafe { o.contents.result };
+                       unsafe { o.contents.result = std::ptr::null_mut() };
+                       CResult_ChannelFeaturesDecodeErrorZPtr { result }
+               } else {
+                       let err = unsafe { o.contents.err };
+                       unsafe { o.contents.err = std::ptr::null_mut(); }
+                       CResult_ChannelFeaturesDecodeErrorZPtr { err }
+               };
+               Self {
+                       contents,
+                       result_ok: o.result_ok,
+               }
+       }
+}
+#[repr(C)]
 pub union CResult_ChannelConfigDecodeErrorZPtr {
        pub result: *mut crate::util::config::ChannelConfig,
        pub err: *mut crate::ln::msgs::DecodeError,
index 80fc6c7c7e51716585b0cc80cdf214b776d3a1d0..77c6b5aded58e6b461ae121f579c0e8734e09093 100644 (file)
@@ -158,7 +158,7 @@ pub extern "C" fn ChannelDetails_set_remote_network_id(this_ptr: &mut ChannelDet
 #[no_mangle]
 pub extern "C" fn ChannelDetails_get_counterparty_features(this_ptr: &ChannelDetails) -> crate::ln::features::InitFeatures {
        let mut inner_val = &mut unsafe { &mut *this_ptr.inner }.counterparty_features;
-       crate::ln::features::InitFeatures { inner: &mut (*inner_val), is_owned: false }
+       crate::ln::features::InitFeatures { inner: unsafe { ( (&((*inner_val)) as *const _) as *mut _) }, is_owned: false }
 }
 /// The Features the channel counterparty provided upon last connection.
 /// Useful for routing as it is the most up-to-date copy of the counterparty's features and
index b01b011a5aea81ff6181467f35c86e0c696f4911..5a5b7b786a4762c2cb47532ceebeef3d40020d65 100644 (file)
@@ -134,3 +134,99 @@ impl ChannelFeatures {
                ret
        }
 }
+/// Create a blank Features with no features set
+#[must_use]
+#[no_mangle]
+pub extern "C" fn InitFeatures_empty() -> InitFeatures {
+       let mut ret = lightning::ln::features::InitFeatures::empty();
+       InitFeatures { inner: Box::into_raw(Box::new(ret)), is_owned: true }
+}
+
+/// Creates features known by the implementation as defined by [`T::KNOWN_FEATURE_FLAGS`].
+///
+/// [`T::KNOWN_FEATURE_FLAGS`]: sealed/trait.Context.html#associatedconstant.KNOWN_FEATURE_FLAGS
+#[must_use]
+#[no_mangle]
+pub extern "C" fn InitFeatures_known() -> InitFeatures {
+       let mut ret = lightning::ln::features::InitFeatures::known();
+       InitFeatures { inner: Box::into_raw(Box::new(ret)), is_owned: true }
+}
+
+/// Create a blank Features with no features set
+#[must_use]
+#[no_mangle]
+pub extern "C" fn NodeFeatures_empty() -> NodeFeatures {
+       let mut ret = lightning::ln::features::NodeFeatures::empty();
+       NodeFeatures { inner: Box::into_raw(Box::new(ret)), is_owned: true }
+}
+
+/// Creates features known by the implementation as defined by [`T::KNOWN_FEATURE_FLAGS`].
+///
+/// [`T::KNOWN_FEATURE_FLAGS`]: sealed/trait.Context.html#associatedconstant.KNOWN_FEATURE_FLAGS
+#[must_use]
+#[no_mangle]
+pub extern "C" fn NodeFeatures_known() -> NodeFeatures {
+       let mut ret = lightning::ln::features::NodeFeatures::known();
+       NodeFeatures { inner: Box::into_raw(Box::new(ret)), is_owned: true }
+}
+
+/// Create a blank Features with no features set
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelFeatures_empty() -> ChannelFeatures {
+       let mut ret = lightning::ln::features::ChannelFeatures::empty();
+       ChannelFeatures { inner: Box::into_raw(Box::new(ret)), is_owned: true }
+}
+
+/// Creates features known by the implementation as defined by [`T::KNOWN_FEATURE_FLAGS`].
+///
+/// [`T::KNOWN_FEATURE_FLAGS`]: sealed/trait.Context.html#associatedconstant.KNOWN_FEATURE_FLAGS
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelFeatures_known() -> ChannelFeatures {
+       let mut ret = lightning::ln::features::ChannelFeatures::known();
+       ChannelFeatures { inner: Box::into_raw(Box::new(ret)), is_owned: true }
+}
+
+#[no_mangle]
+pub extern "C" fn InitFeatures_write(obj: &InitFeatures) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
+}
+#[no_mangle]
+pub(crate) extern "C" fn InitFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInitFeatures) })
+}
+#[no_mangle]
+pub extern "C" fn NodeFeatures_write(obj: &NodeFeatures) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
+}
+#[no_mangle]
+pub(crate) extern "C" fn NodeFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeNodeFeatures) })
+}
+#[no_mangle]
+pub extern "C" fn ChannelFeatures_write(obj: &ChannelFeatures) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })
+}
+#[no_mangle]
+pub(crate) extern "C" fn ChannelFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
+       crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeChannelFeatures) })
+}
+#[no_mangle]
+pub extern "C" fn InitFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InitFeaturesDecodeErrorZ {
+       let res = crate::c_types::deserialize_obj(ser);
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::features::InitFeatures { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
+       local_res
+}
+#[no_mangle]
+pub extern "C" fn NodeFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeFeaturesDecodeErrorZ {
+       let res = crate::c_types::deserialize_obj(ser);
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::features::NodeFeatures { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
+       local_res
+}
+#[no_mangle]
+pub extern "C" fn ChannelFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelFeaturesDecodeErrorZ {
+       let res = crate::c_types::deserialize_obj(ser);
+       let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::ln::features::ChannelFeatures { inner: Box::into_raw(Box::new(o)), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::ln::msgs::DecodeError { inner: Box::into_raw(Box::new(e)), is_owned: true } }).into() };
+       local_res
+}