diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-03-04 02:05:53 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-03-04 02:05:53 +0000 |
commit | 0050b41823df3e3cd20623214eae813809c8c448 (patch) | |
tree | c7137dd1d515ee77f69864a1aa7986dcf3015730 | |
parent | 32ac04017b7d495ecadb40303db8d5a8cbcc5d88 (diff) | |
parent | 2e986769e8a1a0ce20f653f790b02ab6896513ef (diff) | |
download | tokio-stream-0050b41823df3e3cd20623214eae813809c8c448.tar.gz |
Snap for 8249732 from 2e986769e8a1a0ce20f653f790b02ab6896513ef to tm-releaseandroid-vts-13.0_r8android-vts-13.0_r7android-vts-13.0_r6android-vts-13.0_r5android-vts-13.0_r4android-vts-13.0_r3android-vts-13.0_r2android-vts-13.0_r1android-security-13.0.0_r9android-security-13.0.0_r8android-security-13.0.0_r7android-security-13.0.0_r6android-security-13.0.0_r5android-security-13.0.0_r4android-security-13.0.0_r3android-security-13.0.0_r2android-security-13.0.0_r18android-security-13.0.0_r17android-security-13.0.0_r16android-security-13.0.0_r15android-security-13.0.0_r14android-security-13.0.0_r13android-security-13.0.0_r12android-security-13.0.0_r11android-security-13.0.0_r10android-security-13.0.0_r1android-platform-13.0.0_r9android-platform-13.0.0_r8android-platform-13.0.0_r7android-platform-13.0.0_r6android-platform-13.0.0_r5android-platform-13.0.0_r4android-platform-13.0.0_r3android-platform-13.0.0_r20android-platform-13.0.0_r2android-platform-13.0.0_r19android-platform-13.0.0_r18android-platform-13.0.0_r17android-platform-13.0.0_r16android-platform-13.0.0_r15android-platform-13.0.0_r14android-platform-13.0.0_r13android-platform-13.0.0_r12android-platform-13.0.0_r11android-platform-13.0.0_r10android-platform-13.0.0_r1android-cts-13.0_r8android-cts-13.0_r7android-cts-13.0_r6android-cts-13.0_r5android-cts-13.0_r4android-cts-13.0_r3android-cts-13.0_r2android-cts-13.0_r1android-13.0.0_r8android-13.0.0_r7android-13.0.0_r6android-13.0.0_r5android-13.0.0_r4android-13.0.0_r31android-13.0.0_r3android-13.0.0_r2android-13.0.0_r12android-13.0.0_r1android13-tests-releaseandroid13-security-releaseandroid13-s3-releaseandroid13-s2-releaseandroid13-s1-releaseandroid13-releaseandroid13-platform-releaseandroid13-gsi
Change-Id: Idd860e11f505ac4afd81ad63920d18f176753166
-rw-r--r-- | .cargo_vcs_info.json | 2 | ||||
-rw-r--r-- | Android.bp | 2 | ||||
-rw-r--r-- | CHANGELOG.md | 10 | ||||
-rw-r--r-- | Cargo.toml | 14 | ||||
-rw-r--r-- | Cargo.toml.orig | 9 | ||||
-rw-r--r-- | METADATA | 10 | ||||
-rw-r--r-- | src/stream_map.rs | 17 | ||||
-rw-r--r-- | src/wrappers.rs | 13 | ||||
-rw-r--r-- | src/wrappers/broadcast.rs | 6 | ||||
-rw-r--r-- | src/wrappers/mpsc_bounded.rs | 6 | ||||
-rw-r--r-- | src/wrappers/mpsc_unbounded.rs | 6 | ||||
-rw-r--r-- | src/wrappers/watch.rs | 8 | ||||
-rw-r--r-- | tests/watch.rs | 2 |
13 files changed, 77 insertions, 28 deletions
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" } } @@ -23,7 +23,7 @@ rust_library { 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 @@ -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 @@ name = "tokio-stream" # - 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 @@ proptest = "1" [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"] @@ -7,13 +7,13 @@ third_party { } 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 @@ where } } +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_signal! { #[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 @@ impl<T> fmt::Debug for BroadcastStream<T> { 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 @@ impl<T> AsMut<Receiver<T>> for ReceiverStream<T> { &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 @@ impl<T> AsMut<UnboundedReceiver<T>> for UnboundedReceiverStream<T> { &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 @@ async fn make_future<T: Clone + Send + Sync>( (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 @@ impl<T> fmt::Debug for WatchStream<T> { 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; |