Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix write-all-vectored feature #2181

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions futures-util/src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ pub use self::write_vectored::WriteVectored;
mod write_all;
pub use self::write_all::WriteAll;

#[cfg(feature = "write_all_vectored")]
#[cfg(feature = "write-all-vectored")]
mod write_all_vectored;
#[cfg(feature = "write_all_vectored")]
#[cfg(feature = "write-all-vectored")]
pub use self::write_all_vectored::WriteAllVectored;

/// An extension trait which adds utility methods to `AsyncRead` types.
Expand Down Expand Up @@ -493,22 +493,23 @@ pub trait AsyncWriteExt: AsyncWrite {
/// ```
/// # futures::executor::block_on(async {
/// use futures::io::AsyncWriteExt;
/// use std::io::{Cursor, IoSlice};
/// use futures_util::io::Cursor;
/// use std::io::IoSlice;
///
/// let mut writer = Cursor::new([0u8; 7]);
/// let mut writer = Cursor::new(Vec::new());
/// let bufs = &mut [
/// IoSlice::new(&[1]),
/// IoSlice::new(&[2, 3]),
/// IoSlice::new(&[4, 5, 6]),
/// ];
///
/// writer.write_all_vectored(bufs).await?;
/// // Note: the contents of `bufs` is now undefined, see the Notes section.
/// // Note: the contents of `bufs` is now unspecified, see the Notes section.
///
/// assert_eq!(writer.into_inner(), [1, 2, 3, 4, 5, 6, 0]);
/// assert_eq!(writer.into_inner(), &[1, 2, 3, 4, 5, 6]);
/// # Ok::<(), Box<dyn std::error::Error>>(()) }).unwrap();
/// ```
#[cfg(feature = "write_all_vectored")]
#[cfg(feature = "write-all-vectored")]
fn write_all_vectored<'a>(
&'a mut self,
bufs: &'a mut [IoSlice<'a>],
Expand Down