Update auto-generated bindings
[rust-lightning] / lightning-c-bindings / src / ln / features.rs
index b01b011a5aea81ff6181467f35c86e0c696f4911..71adebeb5725210808a956616cc8fa71e0641575 100644 (file)
@@ -20,6 +20,60 @@ use std::ffi::c_void;
 use bitcoin::hashes::Hash;
 use crate::c_types::*;
 
+impl Clone for InitFeatures {
+       fn clone(&self) -> Self {
+               Self {
+                       inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+                               Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
+                       is_owned: true,
+               }
+       }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn InitFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeInitFeatures)).clone() })) as *mut c_void
+}
+#[no_mangle]
+pub extern "C" fn InitFeatures_clone(orig: &InitFeatures) -> InitFeatures {
+       orig.clone()
+}
+impl Clone for NodeFeatures {
+       fn clone(&self) -> Self {
+               Self {
+                       inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+                               Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
+                       is_owned: true,
+               }
+       }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn NodeFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeNodeFeatures)).clone() })) as *mut c_void
+}
+#[no_mangle]
+pub extern "C" fn NodeFeatures_clone(orig: &NodeFeatures) -> NodeFeatures {
+       orig.clone()
+}
+impl Clone for ChannelFeatures {
+       fn clone(&self) -> Self {
+               Self {
+                       inner: if self.inner.is_null() { std::ptr::null_mut() } else {
+                               Box::into_raw(Box::new(unsafe { &*self.inner }.clone())) },
+                       is_owned: true,
+               }
+       }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ChannelFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelFeatures)).clone() })) as *mut c_void
+}
+#[no_mangle]
+pub extern "C" fn ChannelFeatures_clone(orig: &ChannelFeatures) -> ChannelFeatures {
+       orig.clone()
+}
 
 use lightning::ln::features::InitFeatures as nativeInitFeaturesImport;
 type nativeInitFeatures = nativeInitFeaturesImport;
@@ -134,3 +188,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
+}