io: replace Result<T, io::Error> with io::Result<T> in AsyncWrite (#7740)

This commit is contained in:
Paolo Barbolini
2025-11-23 17:26:48 +08:00
committed by GitHub
parent c434ed7865
commit 9a1b076c00
+4 -4
View File
@@ -54,7 +54,7 @@ pub trait AsyncWrite {
self: Pin<&mut Self>, self: Pin<&mut Self>,
cx: &mut Context<'_>, cx: &mut Context<'_>,
buf: &[u8], buf: &[u8],
) -> Poll<Result<usize, io::Error>>; ) -> Poll<io::Result<usize>>;
/// Attempts to flush the object, ensuring that any buffered data reach /// Attempts to flush the object, ensuring that any buffered data reach
/// their destination. /// their destination.
@@ -65,7 +65,7 @@ pub trait AsyncWrite {
/// `Poll::Pending` and arranges for the current task (via /// `Poll::Pending` and arranges for the current task (via
/// `cx.waker()`) to receive a notification when the object can make /// `cx.waker()`) to receive a notification when the object can make
/// progress towards flushing. /// progress towards flushing.
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), io::Error>>; fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<()>>;
/// Initiates or attempts to shut down this writer, returning success when /// Initiates or attempts to shut down this writer, returning success when
/// the I/O connection has completely shut down. /// the I/O connection has completely shut down.
@@ -125,7 +125,7 @@ pub trait AsyncWrite {
/// ///
/// This function will panic if not called within the context of a future's /// This function will panic if not called within the context of a future's
/// task. /// task.
fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), io::Error>>; fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<()>>;
/// Like [`poll_write`], except that it writes from a slice of buffers. /// Like [`poll_write`], except that it writes from a slice of buffers.
/// ///
@@ -154,7 +154,7 @@ pub trait AsyncWrite {
self: Pin<&mut Self>, self: Pin<&mut Self>,
cx: &mut Context<'_>, cx: &mut Context<'_>,
bufs: &[IoSlice<'_>], bufs: &[IoSlice<'_>],
) -> Poll<Result<usize, io::Error>> { ) -> Poll<io::Result<usize>> {
let buf = bufs let buf = bufs
.iter() .iter()
.find(|b| !b.is_empty()) .find(|b| !b.is_empty())