Update tokio-stream to 0.1.8 am: 9efa0491e1 am: e2b36820b8 am: de66ec9265

Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/tokio-stream/+/2005832

Change-Id: I744d8edfaf5d7c6305805276575ca8a95805ade8
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 749a519..f2822a6 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
 {
   "git": {
-    "sha1": "5d61c997e9281e00f35c7ea426786996945f47f5"
+    "sha1": "d1a400912e82505c18c6c0c1f05cda06f334e201"
   }
 }
diff --git a/Android.bp b/Android.bp
index a784467..11ef3d4 100644
--- a/Android.bp
+++ b/Android.bp
@@ -23,7 +23,7 @@
     host_supported: true,
     crate_name: "tokio_stream",
     cargo_env_compat: true,
-    cargo_pkg_version: "0.1.7",
+    cargo_pkg_version: "0.1.8",
     srcs: ["src/lib.rs"],
     edition: "2018",
     features: [
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a0cdef0..4ef469e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,13 @@
+# 0.1.8 (October 29, 2021)
+
+- stream: add `From<Receiver<T>>` impl for receiver streams ([#4080])
+- stream: impl `FromIterator` for `StreamMap` ([#4052])
+- signal: make windows docs for signal module show up on unix builds ([#3770])
+
+[#3770]: https://github.com/tokio-rs/tokio/pull/3770
+[#4052]: https://github.com/tokio-rs/tokio/pull/4052
+[#4080]: https://github.com/tokio-rs/tokio/pull/4080
+
 # 0.1.7 (July 7, 2021)
 
 ### Fixed
diff --git a/Cargo.toml b/Cargo.toml
index 5a8627a..699d94a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,26 +3,26 @@
 # When uploading crates to the registry Cargo will automatically
 # "normalize" Cargo.toml files for maximal compatibility
 # with all versions of Cargo and also rewrite `path` dependencies
-# to registry (e.g., crates.io) dependencies
+# to registry (e.g., crates.io) dependencies.
 #
-# If you believe there's an error in this file please file an
-# issue against the rust-lang/cargo repository. If you're
-# editing this file be aware that the upstream Cargo.toml
-# will likely look very different (and much more reasonable)
+# If you are reading this file be aware that the original Cargo.toml
+# will likely look very different (and much more reasonable).
+# See Cargo.toml.orig for the original contents.
 
 [package]
 edition = "2018"
 name = "tokio-stream"
-version = "0.1.7"
+version = "0.1.8"
 authors = ["Tokio Contributors <team@tokio.rs>"]
 description = "Utilities to work with `Stream` and `tokio`.\n"
 homepage = "https://tokio.rs"
-documentation = "https://docs.rs/tokio-stream/0.1.7/tokio_stream"
+documentation = "https://docs.rs/tokio-stream/0.1.8/tokio_stream"
 categories = ["asynchronous"]
 license = "MIT"
 repository = "https://github.com/tokio-rs/tokio"
 [package.metadata.docs.rs]
 all-features = true
+rustc-args = ["--cfg", "docsrs"]
 rustdoc-args = ["--cfg", "docsrs"]
 [dependencies.futures-core]
 version = "0.3.0"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 911657c..83f8551 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -6,13 +6,13 @@
 #   - Cargo.toml
 # - Update CHANGELOG.md.
 # - Create "tokio-stream-0.1.x" git tag.
-version = "0.1.7"
+version = "0.1.8"
 edition = "2018"
 authors = ["Tokio Contributors <team@tokio.rs>"]
 license = "MIT"
 repository = "https://github.com/tokio-rs/tokio"
 homepage = "https://tokio.rs"
-documentation = "https://docs.rs/tokio-stream/0.1.7/tokio_stream"
+documentation = "https://docs.rs/tokio-stream/0.1.8/tokio_stream"
 description = """
 Utilities to work with `Stream` and `tokio`.
 """
@@ -44,3 +44,8 @@
 [package.metadata.docs.rs]
 all-features = true
 rustdoc-args = ["--cfg", "docsrs"]
+# Issue #3770
+#
+# This should allow `docsrs` to be read across projects, so that `tokio-stream`
+# can pick up stubbed types exported by `tokio`.
+rustc-args = ["--cfg", "docsrs"]
diff --git a/METADATA b/METADATA
index 8693d16..68e56e9 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@
   }
   url {
     type: ARCHIVE
-    value: "https://static.crates.io/crates/tokio-stream/tokio-stream-0.1.7.crate"
+    value: "https://static.crates.io/crates/tokio-stream/tokio-stream-0.1.8.crate"
   }
-  version: "0.1.7"
+  version: "0.1.8"
   license_type: NOTICE
   last_upgrade_date {
-    year: 2021
-    month: 8
-    day: 9
+    year: 2022
+    month: 3
+    day: 1
   }
 }
diff --git a/src/stream_map.rs b/src/stream_map.rs
index 9dc529a..80a521e 100644
--- a/src/stream_map.rs
+++ b/src/stream_map.rs
@@ -568,6 +568,23 @@
     }
 }
 
+impl<K, V> std::iter::FromIterator<(K, V)> for StreamMap<K, V>
+where
+    K: Hash + Eq,
+{
+    fn from_iter<T: IntoIterator<Item = (K, V)>>(iter: T) -> Self {
+        let iterator = iter.into_iter();
+        let (lower_bound, _) = iterator.size_hint();
+        let mut stream_map = Self::with_capacity(lower_bound);
+
+        for (key, value) in iterator {
+            stream_map.insert(key, value);
+        }
+
+        stream_map
+    }
+}
+
 mod rand {
     use std::cell::Cell;
 
diff --git a/src/wrappers.rs b/src/wrappers.rs
index f2dc21f..62cabe4 100644
--- a/src/wrappers.rs
+++ b/src/wrappers.rs
@@ -1,13 +1,4 @@
 //! Wrappers for Tokio types that implement `Stream`.
-//!
-#![cfg_attr(
-    unix,
-    doc = "You are viewing documentation built under unix. To view windows-specific wrappers, change to the `x86_64-pc-windows-msvc` platform."
-)]
-#![cfg_attr(
-    windows,
-    doc = "You are viewing documentation built under windows. To view unix-specific wrappers, change to the `x86_64-unknown-linux-gnu` platform."
-)]
 
 /// Error types for the wrappers.
 pub mod errors {
@@ -36,9 +27,9 @@
     #[cfg(unix)]
     pub use signal_unix::SignalStream;
 
-    #[cfg(windows)]
+    #[cfg(any(windows, docsrs))]
     mod signal_windows;
-    #[cfg(windows)]
+    #[cfg(any(windows, docsrs))]
     pub use signal_windows::{CtrlCStream, CtrlBreakStream};
 }
 
diff --git a/src/wrappers/broadcast.rs b/src/wrappers/broadcast.rs
index 3bddbb7..c8346a6 100644
--- a/src/wrappers/broadcast.rs
+++ b/src/wrappers/broadcast.rs
@@ -71,3 +71,9 @@
         f.debug_struct("BroadcastStream").finish()
     }
 }
+
+impl<T: 'static + Clone + Send> From<Receiver<T>> for BroadcastStream<T> {
+    fn from(recv: Receiver<T>) -> Self {
+        Self::new(recv)
+    }
+}
diff --git a/src/wrappers/mpsc_bounded.rs b/src/wrappers/mpsc_bounded.rs
index e4f9000..b536268 100644
--- a/src/wrappers/mpsc_bounded.rs
+++ b/src/wrappers/mpsc_bounded.rs
@@ -57,3 +57,9 @@
         &mut self.inner
     }
 }
+
+impl<T> From<Receiver<T>> for ReceiverStream<T> {
+    fn from(recv: Receiver<T>) -> Self {
+        Self::new(recv)
+    }
+}
diff --git a/src/wrappers/mpsc_unbounded.rs b/src/wrappers/mpsc_unbounded.rs
index bc5f40c..54597b7 100644
--- a/src/wrappers/mpsc_unbounded.rs
+++ b/src/wrappers/mpsc_unbounded.rs
@@ -51,3 +51,9 @@
         &mut self.inner
     }
 }
+
+impl<T> From<UnboundedReceiver<T>> for UnboundedReceiverStream<T> {
+    fn from(recv: UnboundedReceiver<T>) -> Self {
+        Self::new(recv)
+    }
+}
diff --git a/src/wrappers/watch.rs b/src/wrappers/watch.rs
index 1daca10..bd3a18a 100644
--- a/src/wrappers/watch.rs
+++ b/src/wrappers/watch.rs
@@ -59,7 +59,7 @@
     (result, rx)
 }
 
-impl<T: 'static + Clone + Unpin + Send + Sync> WatchStream<T> {
+impl<T: 'static + Clone + Send + Sync> WatchStream<T> {
     /// Create a new `WatchStream`.
     pub fn new(rx: Receiver<T>) -> Self {
         Self {
@@ -94,3 +94,9 @@
         f.debug_struct("WatchStream").finish()
     }
 }
+
+impl<T: 'static + Clone + Send + Sync> From<Receiver<T>> for WatchStream<T> {
+    fn from(recv: Receiver<T>) -> Self {
+        Self::new(recv)
+    }
+}
diff --git a/tests/watch.rs b/tests/watch.rs
index 92bcdf4..a56254e 100644
--- a/tests/watch.rs
+++ b/tests/watch.rs
@@ -1,3 +1,5 @@
+#![cfg(feature = "sync")]
+
 use tokio::sync::watch;
 use tokio_stream::wrappers::WatchStream;
 use tokio_stream::StreamExt;