X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Fsrc%2Flightning%2Fchain%2Fchannelmonitor.rs;h=dccc80d1af0b3cbd9f8ef4d130103d33ae047a8b;hb=99e52fb74ad4d35f8d664050d9f269ac21a5850b;hp=1331506e033bbff55b2809c499c100488221aa48;hpb=875eff054987b2396f2ece3675383dae6c0d42d7;p=ldk-c-bindings diff --git a/lightning-c-bindings/src/lightning/chain/channelmonitor.rs b/lightning-c-bindings/src/lightning/chain/channelmonitor.rs index 1331506..dccc80d 100644 --- a/lightning-c-bindings/src/lightning/chain/channelmonitor.rs +++ b/lightning-c-bindings/src/lightning/chain/channelmonitor.rs @@ -544,6 +544,25 @@ impl ChannelMonitor { ret } } +impl Clone for ChannelMonitor { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeChannelMonitor>::is_null(self.inner) { 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] +/// Creates a copy of the ChannelMonitor +pub extern "C" fn ChannelMonitor_clone(orig: &ChannelMonitor) -> ChannelMonitor { + orig.clone() +} #[no_mangle] /// Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read pub extern "C" fn ChannelMonitor_write(obj: &ChannelMonitor) -> crate::c_types::derived::CVec_u8Z {