]> git.bitcoin.ninja Git - rust-lightning/commitdiff
- bindings updates
authorMatt Corallo <git@bluematt.me>
Thu, 11 Feb 2021 18:00:11 +0000 (13:00 -0500)
committerMatt Corallo <git@bluematt.me>
Thu, 11 Feb 2021 21:19:56 +0000 (16:19 -0500)
lightning-c-bindings/include/lightning.h
lightning-c-bindings/src/c_types/derived.rs
lightning-c-bindings/src/chain/channelmonitor.rs

index 704feb9b150dc82daf0486ff06f43d55d38968ec..509afd2c5ecc1f47a03be63af546370021b0f305 100644 (file)
@@ -5090,6 +5090,8 @@ struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
 
 void ChannelMonitor_free(struct LDKChannelMonitor this_ptr);
 
+struct LDKChannelMonitor ChannelMonitor_clone(const struct LDKChannelMonitor *NONNULL_PTR orig);
+
 struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
 
 /**
index d76374ae64c2631fc6991aa80e99116951d8f309..a418ccc2a8c2abf464e622412cda8d4cc4b9db59 100644 (file)
@@ -3430,6 +3430,14 @@ impl Drop for CVec_ChannelMonitorZ {
                unsafe { Box::from_raw(std::slice::from_raw_parts_mut(self.data, self.datalen)) };
        }
 }
+impl Clone for CVec_ChannelMonitorZ {
+       fn clone(&self) -> Self {
+               let mut res = Vec::new();
+               if self.datalen == 0 { return Self::from(res); }
+               res.extend_from_slice(unsafe { std::slice::from_raw_parts_mut(self.data, self.datalen) });
+               Self::from(res)
+       }
+}
 #[repr(C)]
 pub struct C2Tuple_BlockHashChannelManagerZ {
        pub a: crate::c_types::ThirtyTwoBytes,
index 8b9a3afc8e157758bcbe7e62e2d19bbd5fb3f220..116bb37d709e8cbcbdeb45bb79f07cfcafee7f38 100644 (file)
@@ -466,6 +466,24 @@ impl ChannelMonitor {
                ret
        }
 }
+impl Clone for ChannelMonitor {
+       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 ChannelMonitor_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelMonitor)).clone() })) as *mut c_void
+}
+#[no_mangle]
+pub extern "C" fn ChannelMonitor_clone(orig: &ChannelMonitor) -> ChannelMonitor {
+       orig.clone()
+}
 #[no_mangle]
 pub extern "C" fn ChannelMonitor_write(obj: &ChannelMonitor) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(unsafe { &*unsafe { &*obj }.inner })