|
1 | 1 | use std::{future::Future, io};
|
2 | 2 |
|
3 | 3 | use crate::{
|
4 |
| - buf::{IoVecWrapper, Slice}, |
| 4 | + buf::{IoBuf, IoBufMut, IoVecBuf, IoVecBufMut, IoVecWrapper, Slice}, |
5 | 5 | io::{AsyncBufRead, AsyncReadRent, AsyncWriteRent, AsyncWriteRentExt},
|
6 | 6 | };
|
7 | 7 |
|
@@ -85,18 +85,18 @@ impl<W: AsyncWriteRent> BufWriter<W> {
|
85 | 85 |
|
86 | 86 | impl<W: AsyncWriteRent> AsyncWriteRent for BufWriter<W> {
|
87 | 87 | type WriteFuture<'a, T> = impl Future<Output = crate::BufResult<usize, T>> where
|
88 |
| - T: 'a, W: 'a; |
| 88 | + T: IoBuf + 'a, W: 'a; |
89 | 89 |
|
90 | 90 | type WritevFuture<'a, T> = impl Future<Output = crate::BufResult<usize, T>> where
|
91 |
| - T: 'a, W: 'a; |
| 91 | + T: IoVecBuf + 'a, W: 'a; |
92 | 92 |
|
93 | 93 | type FlushFuture<'a> = impl Future<Output = io::Result<()>> where
|
94 | 94 | W: 'a;
|
95 | 95 |
|
96 | 96 | type ShutdownFuture<'a> = impl Future<Output = io::Result<()>> where
|
97 | 97 | W: 'a;
|
98 | 98 |
|
99 |
| - fn write<T: crate::buf::IoBuf>(&mut self, buf: T) -> Self::WriteFuture<'_, T> { |
| 99 | + fn write<T: IoBuf>(&mut self, buf: T) -> Self::WriteFuture<'_, T> { |
100 | 100 | async move {
|
101 | 101 | let owned_buf = self.buf.as_ref().unwrap();
|
102 | 102 | let owned_len = owned_buf.len();
|
@@ -136,7 +136,7 @@ impl<W: AsyncWriteRent> AsyncWriteRent for BufWriter<W> {
|
136 | 136 | }
|
137 | 137 |
|
138 | 138 | // TODO: implement it as real io_vec
|
139 |
| - fn writev<T: crate::buf::IoVecBuf>(&mut self, buf: T) -> Self::WritevFuture<'_, T> { |
| 139 | + fn writev<T: IoVecBuf>(&mut self, buf: T) -> Self::WritevFuture<'_, T> { |
140 | 140 | async move {
|
141 | 141 | let slice = match IoVecWrapper::new(buf) {
|
142 | 142 | Ok(slice) => slice,
|
@@ -165,16 +165,16 @@ impl<W: AsyncWriteRent> AsyncWriteRent for BufWriter<W> {
|
165 | 165 |
|
166 | 166 | impl<W: AsyncWriteRent + AsyncReadRent> AsyncReadRent for BufWriter<W> {
|
167 | 167 | type ReadFuture<'a, T> = W::ReadFuture<'a, T> where
|
168 |
| - T: 'a, W: 'a; |
| 168 | + T: IoBufMut + 'a, W: 'a; |
169 | 169 |
|
170 | 170 | type ReadvFuture<'a, T> = W::ReadvFuture<'a, T> where
|
171 |
| - T: 'a, W: 'a; |
| 171 | + T: IoVecBufMut + 'a, W: 'a; |
172 | 172 |
|
173 |
| - fn read<T: crate::buf::IoBufMut>(&mut self, buf: T) -> Self::ReadFuture<'_, T> { |
| 173 | + fn read<T: IoBufMut>(&mut self, buf: T) -> Self::ReadFuture<'_, T> { |
174 | 174 | self.inner.read(buf)
|
175 | 175 | }
|
176 | 176 |
|
177 |
| - fn readv<T: crate::buf::IoVecBufMut>(&mut self, buf: T) -> Self::ReadvFuture<'_, T> { |
| 177 | + fn readv<T: IoVecBufMut>(&mut self, buf: T) -> Self::ReadvFuture<'_, T> { |
178 | 178 | self.inner.readv(buf)
|
179 | 179 | }
|
180 | 180 | }
|
|
0 commit comments