Loosen requiremenst on IoImpl
This commit is contained in:
parent
2f493c724f
commit
520f3fd949
|
|
@ -1,7 +1,4 @@
|
|||
use crate::{
|
||||
aliases::IoResult,
|
||||
io::{AsyncReadLoan, AsyncWriteLoan},
|
||||
};
|
||||
use crate::aliases::IoResult;
|
||||
use std::{future::Future, net::SocketAddr, time::Duration};
|
||||
|
||||
#[cfg(feature = "io_uring")]
|
||||
|
|
@ -26,7 +23,7 @@ pub trait IoImpl {
|
|||
listener: &mut Self::TcpListener,
|
||||
) -> impl Future<Output = IoResult<Self::Incoming>>;
|
||||
|
||||
type TcpStream: AsyncReadLoan + AsyncWriteLoan;
|
||||
type TcpStream;
|
||||
fn tcp_connect(
|
||||
&self,
|
||||
socket: SocketAddr,
|
||||
|
|
|
|||
10
src/net.rs
10
src/net.rs
|
|
@ -18,13 +18,19 @@ impl<I: IoImpl> TcpStream<I> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<I: IoImpl> AsyncReadLoan for TcpStream<I> {
|
||||
impl<I: IoImpl> AsyncReadLoan for TcpStream<I>
|
||||
where
|
||||
I::TcpStream: AsyncReadLoan,
|
||||
{
|
||||
async fn read<B: BufferMut>(&mut self, buf: B) -> (B, IoResult<usize>) {
|
||||
self.0.read(buf).await
|
||||
}
|
||||
}
|
||||
|
||||
impl<I: IoImpl> AsyncWriteLoan for TcpStream<I> {
|
||||
impl<I: IoImpl> AsyncWriteLoan for TcpStream<I>
|
||||
where
|
||||
I::TcpStream: AsyncWriteLoan,
|
||||
{
|
||||
async fn write<B: Buffer>(&mut self, buf: B) -> (B, IoResult<usize>) {
|
||||
self.0.write(buf).await
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue