Merge pull request #758 from TheBlueMatt/2020-11-bindings-fix
[rust-lightning] / lightning-c-bindings / src / ln / channelmanager.rs
index 9d2de5b7d773359fd385b320d68801a20c1d11b4..c21f26e94e05bfc2c7c3bb4069f4135293e10f5f 100644 (file)
@@ -56,7 +56,7 @@ type nativeChannelManager = nativeChannelManagerImport<crate::chain::keysinterfa
 #[must_use]
 #[repr(C)]
 pub struct ChannelManager {
-       /// Nearly everyhwere, inner must be non-null, however in places where
+       /// 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.
        pub inner: *mut nativeChannelManager,
        pub is_owned: bool,
@@ -94,7 +94,7 @@ type nativeChannelDetails = nativeChannelDetailsImport;
 #[must_use]
 #[repr(C)]
 pub struct ChannelDetails {
-       /// Nearly everyhwere, inner must be non-null, however in places where
+       /// 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.
        pub inner: *mut nativeChannelDetails,
        pub is_owned: bool,
@@ -124,6 +124,23 @@ impl ChannelDetails {
                ret
        }
 }
+impl Clone for ChannelDetails {
+       fn clone(&self) -> Self {
+               Self {
+                       inner: 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 ChannelDetails_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeChannelDetails)).clone() })) as *mut c_void
+}
+#[no_mangle]
+pub extern "C" fn ChannelDetails_clone(orig: &ChannelDetails) -> ChannelDetails {
+       ChannelDetails { inner: Box::into_raw(Box::new(unsafe { &*orig.inner }.clone())), is_owned: true }
+}
 /// The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
 /// thereafter this is the txid of the funding transaction xor the funding transaction output).
 /// Note that this means this value is *not* persistent - it can change once during the
@@ -248,7 +265,7 @@ type nativePaymentSendFailure = nativePaymentSendFailureImport;
 #[must_use]
 #[repr(C)]
 pub struct PaymentSendFailure {
-       /// Nearly everyhwere, inner must be non-null, however in places where
+       /// 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.
        pub inner: *mut nativePaymentSendFailure,
        pub is_owned: bool,
@@ -705,7 +722,7 @@ type nativeChannelManagerReadArgs = nativeChannelManagerReadArgsImport<'static,
 #[must_use]
 #[repr(C)]
 pub struct ChannelManagerReadArgs {
-       /// Nearly everyhwere, inner must be non-null, however in places where
+       /// 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.
        pub inner: *mut nativeChannelManagerReadArgs,
        pub is_owned: bool,