Update auto-generated bindings
[rust-lightning] / lightning-c-bindings / src / ln / peer_handler.rs
index a763db63e4c95d28bbe96d78e6644cf1dee470ec..50e1c3696a8d222e0017a2e6309e8fc2408c0f02 100644 (file)
@@ -18,7 +18,7 @@ type nativeMessageHandler = nativeMessageHandlerImport<crate::ln::msgs::ChannelM
 #[must_use]
 #[repr(C)]
 pub struct MessageHandler {
-       /// 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 nativeMessageHandler,
        pub is_owned: bool,
@@ -118,29 +118,33 @@ pub struct SocketDescriptor {
        /// though races may occur whereby disconnect_socket is called after a call to
        /// socket_disconnected but prior to socket_disconnected returning.
        pub disconnect_socket: extern "C" fn (this_arg: *mut c_void),
-       pub eq: extern "C" fn (this_arg: *const c_void, other_arg: *const c_void) -> bool,
+       pub eq: extern "C" fn (this_arg: *const c_void, other_arg: &SocketDescriptor) -> bool,
        pub hash: extern "C" fn (this_arg: *const c_void) -> u64,
        pub clone: Option<extern "C" fn (this_arg: *const c_void) -> *mut c_void>,
        pub free: Option<extern "C" fn(this_arg: *mut c_void)>,
 }
 impl std::cmp::Eq for SocketDescriptor {}
 impl std::cmp::PartialEq for SocketDescriptor {
-       fn eq(&self, o: &Self) -> bool { (self.eq)(self.this_arg, o.this_arg) }
+       fn eq(&self, o: &Self) -> bool { (self.eq)(self.this_arg, o) }
 }
 impl std::hash::Hash for SocketDescriptor {
        fn hash<H: std::hash::Hasher>(&self, hasher: &mut H) { hasher.write_u64((self.hash)(self.this_arg)) }
 }
+#[no_mangle]
+pub extern "C" fn SocketDescriptor_clone(orig: &SocketDescriptor) -> SocketDescriptor {
+       SocketDescriptor {
+               this_arg: if let Some(f) = orig.clone { (f)(orig.this_arg) } else { orig.this_arg },
+               send_data: orig.send_data.clone(),
+               disconnect_socket: orig.disconnect_socket.clone(),
+               eq: orig.eq.clone(),
+               hash: orig.hash.clone(),
+               clone: orig.clone.clone(),
+               free: orig.free.clone(),
+       }
+}
 impl Clone for SocketDescriptor {
        fn clone(&self) -> Self {
-               Self {
-               this_arg: if let Some(f) = self.clone { (f)(self.this_arg) } else { self.this_arg },
-                       send_data: self.send_data.clone(),
-                       disconnect_socket: self.disconnect_socket.clone(),
-                       eq: self.eq.clone(),
-                       hash: self.hash.clone(),
-                       clone: self.clone.clone(),
-                       free: self.free.clone(),
-               }
+               SocketDescriptor_clone(self)
        }
 }
 
@@ -186,7 +190,7 @@ type nativePeerHandleError = nativePeerHandleErrorImport;
 #[must_use]
 #[repr(C)]
 pub struct PeerHandleError {
-       /// 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 nativePeerHandleError,
        pub is_owned: bool,
@@ -251,7 +255,7 @@ type nativePeerManager = nativePeerManagerImport<crate::ln::peer_handler::Socket
 #[must_use]
 #[repr(C)]
 pub struct PeerManager {
-       /// 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 nativePeerManager,
        pub is_owned: bool,