Xuanwo commented on code in PR #5471:
URL: https://github.com/apache/opendal/pull/5471#discussion_r2031080907


##########
core/src/services/memcached/binary.rs:
##########
@@ -98,11 +98,11 @@ pub struct Response {
 }
 
 pub struct Connection {
-    io: BufReader<TcpStream>,
+    io: BufReader<Box<dyn Connect>>,
 }

Review Comment:
   How about using:
   
   ```rust
   pub struct Connection<IO: AsyncRead + AsyncWrite>{
       io: IO,
   }
   ```
   
   So we don't need to `Box<dyn Connect>` here?



##########
core/src/services/memcached/binary.rs:
##########
@@ -287,3 +291,12 @@ pub async fn parse_response(reader: &mut TcpStream) -> 
Result<Response> {
         value,
     })
 }
+
+#[async_trait::async_trait]
+pub trait Connect:
+    AsyncWrite + std::marker::Unpin + tokio::io::AsyncRead + std::marker::Send
+{
+}
+
+impl Connect for TcpStream {}
+impl Connect for TlsStream<TcpStream> {}

Review Comment:
   Maybe we don't this trait? 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to