mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-13 01:51:23 +00:00
Address some review comments on #1328
This commit is contained in:
@ -19,7 +19,7 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
use crate::{muxing::StreamMuxer, ProtocolName, transport::ListenerEvent};
|
||||
use futures::prelude::*;
|
||||
use futures::{prelude::*, io::{IoSlice, IoSliceMut}};
|
||||
use pin_project::{pin_project, project};
|
||||
use std::{fmt, io::{Error as IoError}, pin::Pin, task::Context, task::Poll};
|
||||
|
||||
@ -77,6 +77,17 @@ where
|
||||
EitherOutput::Second(b) => AsyncRead::poll_read(b, cx, buf),
|
||||
}
|
||||
}
|
||||
|
||||
#[project]
|
||||
fn poll_read_vectored(self: Pin<&mut Self>, cx: &mut Context, bufs: &mut [IoSliceMut])
|
||||
-> Poll<Result<usize, IoError>>
|
||||
{
|
||||
#[project]
|
||||
match self.project() {
|
||||
EitherOutput::First(a) => AsyncRead::poll_read_vectored(a, cx, bufs),
|
||||
EitherOutput::Second(b) => AsyncRead::poll_read_vectored(b, cx, bufs),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<A, B> AsyncWrite for EitherOutput<A, B>
|
||||
@ -93,6 +104,17 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[project]
|
||||
fn poll_write_vectored(self: Pin<&mut Self>, cx: &mut Context, bufs: &[IoSlice])
|
||||
-> Poll<Result<usize, IoError>>
|
||||
{
|
||||
#[project]
|
||||
match self.project() {
|
||||
EitherOutput::First(a) => AsyncWrite::poll_write_vectored(a, cx, bufs),
|
||||
EitherOutput::Second(b) => AsyncWrite::poll_write_vectored(b, cx, bufs),
|
||||
}
|
||||
}
|
||||
|
||||
#[project]
|
||||
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Result<(), IoError>> {
|
||||
#[project]
|
||||
|
Reference in New Issue
Block a user