3

Add `TryStreamExt::try_forward`, remove `TryStream` bound from `StreamExt::forwa...

 2 years ago
source link: https://github.com/rust-lang/futures-rs/pull/2469
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

Contributor

@yaymukund yaymukund left a comment •

edited

Thanks for pushing this forward.

I was able to get tests to pass by fixing the compile error (see inline comment) and applying:

diff --git futures-util/src/io/mod.rs futures-util/src/io/mod.rs
index b96223d1..00231fa1 100644
--- futures-util/src/io/mod.rs
+++ futures-util/src/io/mod.rs
@@ -570,13 +570,13 @@ pub trait AsyncWriteExt: AsyncWrite {
     /// ```
     /// # futures::executor::block_on(async {
     /// use futures::io::AsyncWriteExt;
-    /// use futures::stream::{self, StreamExt};
+    /// use futures::stream::{self, TryStreamExt};
     ///
     /// let stream = stream::iter(vec![Ok([1, 2, 3]), Ok([4, 5, 6])]);
     ///
     /// let mut writer = vec![];
     ///
-    /// stream.forward((&mut writer).into_sink()).await?;
+    /// stream.try_forward((&mut writer).into_sink()).await?;
     ///
     /// assert_eq!(writer, vec![1, 2, 3, 4, 5, 6]);
     /// # Ok::<(), Box<dyn std::error::Error>>(())

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK