From 3c42c400e0f53a3c44cbdb438b0c23370b62b3a1 Mon Sep 17 00:00:00 2001 From: threadexio Date: Sun, 5 May 2024 02:29:32 +0300 Subject: [PATCH] refactor: delegate send to non-generic variant --- channels/src/sender.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/channels/src/sender.rs b/channels/src/sender.rs index d8df2fc..cb3feae 100644 --- a/channels/src/sender.rs +++ b/channels/src/sender.rs @@ -275,7 +275,14 @@ where where D: Borrow, { - let payload = self.serialize_t(data.borrow())?; + self._send(data.borrow()).await + } + + async fn _send( + &mut self, + data: &T, + ) -> Result<(), SendError> { + let payload = self.serialize_t(data)?; crate::protocol::send_async( &self.config, @@ -324,7 +331,14 @@ where where D: Borrow, { - let payload = self.serialize_t(data.borrow())?; + self._send_blocking(data.borrow()) + } + + fn _send_blocking( + &mut self, + data: &T, + ) -> Result<(), SendError> { + let payload = self.serialize_t(data)?; crate::protocol::send_sync( &self.config,