From 39eac2ab473f2b7de30fd5a883fef9c91e366d77 Mon Sep 17 00:00:00 2001 From: Philip Homburg Date: Thu, 10 Aug 2023 10:56:57 +0200 Subject: [PATCH] Fmt --- src/net/client/multi_stream.rs | 8 +++++--- src/net/client/octet_stream.rs | 21 +++++++++++++++++---- src/net/client/query.rs | 4 +++- src/net/client/udp.rs | 16 +++++++++++----- src/net/client/udp_tcp.rs | 22 +++++++++------------- 5 files changed, 45 insertions(+), 26 deletions(-) diff --git a/src/net/client/multi_stream.rs b/src/net/client/multi_stream.rs index ee8321076..6a26c9e95 100644 --- a/src/net/client/multi_stream.rs +++ b/src/net/client/multi_stream.rs @@ -531,7 +531,8 @@ impl query_msg: &'a mut MessageBuilder< StaticCompressor>, >, - ) -> Pin, Error>> + Send + '_>> { + ) -> Pin, Error>> + Send + '_>> + { return Box::pin(self.query_impl(query_msg)); } } @@ -680,8 +681,9 @@ impl< { fn get_result( &mut self, - ) -> Pin, Error>> + Send + '_>> - { + ) -> Pin< + Box, Error>> + Send + '_>, + > { Box::pin(self.get_result_impl()) } } diff --git a/src/net/client/octet_stream.rs b/src/net/client/octet_stream.rs index 05f7a6026..b0f810c9f 100644 --- a/src/net/client/octet_stream.rs +++ b/src/net/client/octet_stream.rs @@ -769,7 +769,13 @@ impl + Clone + Composer + Debug + OctetsBuilder> } impl< - Octs: AsMut<[u8]> + AsRef<[u8]> + Clone + Composer + Debug + OctetsBuilder + Send, + Octs: AsMut<[u8]> + + AsRef<[u8]> + + Clone + + Composer + + Debug + + OctetsBuilder + + Send, > Connection { /// Constructor for [Connection]. @@ -822,7 +828,13 @@ impl< } impl< - Octs: AsMut<[u8]> + AsRef<[u8]> + Clone + Composer + Debug + OctetsBuilder + Send, + Octs: AsMut<[u8]> + + AsRef<[u8]> + + Clone + + Composer + + Debug + + OctetsBuilder + + Send, > QueryMessage for Connection { fn query<'a>( @@ -891,8 +903,9 @@ impl Query { impl GetResult for Query { fn get_result( &mut self, - ) -> Pin, Error>> + Send + '_>> - { + ) -> Pin< + Box, Error>> + Send + '_>, + > { Box::pin(self.get_result_impl()) } } diff --git a/src/net/client/query.rs b/src/net/client/query.rs index 56881a07b..248648358 100644 --- a/src/net/client/query.rs +++ b/src/net/client/query.rs @@ -32,5 +32,7 @@ pub trait GetResult { /// This function is intended to be cancel safe. fn get_result( &mut self, - ) -> Pin, Error>> + Send + '_>>; + ) -> Pin< + Box, Error>> + Send + '_>, + >; } diff --git a/src/net/client/udp.rs b/src/net/client/udp.rs index 34e42e9fd..d737e816b 100644 --- a/src/net/client/udp.rs +++ b/src/net/client/udp.rs @@ -73,7 +73,8 @@ impl + Clone + Send> QueryMessage, Octs> query_msg: &'a mut MessageBuilder< StaticCompressor>, >, - ) -> Pin, Error>> + Send + '_>> { + ) -> Pin, Error>> + Send + '_>> + { return Box::pin(self.query_impl(query_msg)); } } @@ -168,12 +169,16 @@ impl + Clone + Send> Query { continue; } QueryState::Send => { - let dgram = self.query_msg .as_target() .as_target() .as_dgram_slice(); + let dgram = self + .query_msg + .as_target() + .as_target() + .as_dgram_slice(); let sent = self .sock .as_ref() .expect("socket should be present") - .send( dgram) + .send(dgram) .await .map_err(|e| Error::UdpSend(Arc::new(e)))?; if sent @@ -264,8 +269,9 @@ impl + Clone + Send> Query { impl + Clone + Send> GetResult for Query { fn get_result( &mut self, - ) -> Pin, Error>> + Send + '_>> - { + ) -> Pin< + Box, Error>> + Send + '_>, + > { Box::pin(self.get_result_impl()) } } diff --git a/src/net/client/udp_tcp.rs b/src/net/client/udp_tcp.rs index 76491b889..b48edf5b6 100644 --- a/src/net/client/udp_tcp.rs +++ b/src/net/client/udp_tcp.rs @@ -65,7 +65,8 @@ impl query_msg: &'a mut MessageBuilder< StaticCompressor>, >, - ) -> Pin, Error>> + Send + '_>> { + ) -> Pin, Error>> + Send + '_>> + { return Box::pin(self.query_impl(query_msg)); } } @@ -134,11 +135,8 @@ impl< loop { match &mut self.state { QueryState::StartUdpQuery => { - let mut msg = self.query_msg.clone(); - let query = self - .udp_conn - .query(&mut msg) - .await?; + let mut msg = self.query_msg.clone(); + let query = self.udp_conn.query(&mut msg).await?; self.state = QueryState::GetUdpResult(query); continue; } @@ -151,11 +149,8 @@ impl< return Ok(reply); } QueryState::StartTcpQuery => { - let mut msg = self.query_msg.clone(); - let query = self - .tcp_conn - .query(&mut msg) - .await?; + let mut msg = self.query_msg.clone(); + let query = self.tcp_conn.query(&mut msg).await?; self.state = QueryState::GetTcpResult(query); continue; } @@ -181,8 +176,9 @@ impl< { fn get_result( &mut self, - ) -> Pin, Error>> + Send + '_>> - { + ) -> Pin< + Box, Error>> + Send + '_>, + > { Box::pin(self.get_result_impl()) } }