46 Commits

Author SHA1 Message Date
Hayden Stainsby
485ca3e37c
stream: add track_caller to public APIs (#4786)
Functions that may panic can be annotated with `#[track_caller]` so that
in the event of a panic, the function where the user called the
panicking function is shown instead of the file and line within Tokio
source.

This change adds `#[track_caller]` to all the non-unstable public APIs
in tokio-stream (only `chunks_timeout` in `StreamExt`) where the
documentation describes how this function may panic due to incorrect
input.

A test has been included to cover the panic.

Refs: #4413
2022-06-22 17:27:23 +00:00
Richard Zak
f26ce08f37
chore: fix spelling (#4769)
Signed-off-by: Richard Zak <richard@profian.com>
2022-06-15 16:06:50 +00:00
jefftt
7011a68343
time: add StreamExt::chunks_timeout (#4695) 2022-06-06 16:16:50 +02:00
Gus Wynn
05cbfae177
stream: add cancel-safety docs to StreamExt::next and try_next (#4715) 2022-05-27 10:28:29 +02:00
Stepan Koltsov
3652f71ade
sync: add Clone to RecvError types (#4560) 2022-04-06 15:26:45 +02:00
Adam Cigánek
7d3b9d73ff
stream: expose Timout (#4601) 2022-04-06 15:17:58 +02:00
Alisue
014be71cca
stream: expose Elapsed error (#4502) 2022-03-02 13:53:21 +01:00
Kestrer
9c688ecdc3
util: add lifetime parameter to ReusableBoxFuture (#3762)
Co-authored-by: Toby Lawrence <toby@nuclearfurnace.com>
2022-02-09 14:29:21 -05:00
Braulio Valdivielso Martínez
fb35c83944
tokio-stream: add StreamExt::map_while (#4351)
Fixes #4337

Rust 1.57 stabilized the `Iterator::map_while` API. This PR adds the
same functionality to the `StreamExt` trait, to keep parity.
2021-12-31 22:53:09 +09:00
Alice Ryhl
dda8da75d0
stream: add StreamExt::then (#4355) 2021-12-30 15:28:13 +01:00
David Pedersen
3b339024f0
stream: impl Extend for StreamMap (#4272)
## Motivation

This allows `StreamMap` to be used with [`futures::stream::StreamExt::collect`][collect].

My use case is something like this:

```rust
let stream_map: StreamMap<_, _> = things
    .into_iter()
    .map(|thing| make_stream(thing)) // iterator of futures
    .collect::<FuturesUnordered<_>>() // stream of streams
    .collect::<StreamMap<_, _>>() // combine all the inner streams into one
    .await;

async fn make_stream(thing: Thing) -> impl Stream { ... }
```

[collect]: https://docs.rs/futures/0.3.17/futures/stream/trait.StreamExt.html#method.collect

## Solution

Add `Extend` impl that delegates to the inner `Vec`.
2021-11-23 11:54:06 +01:00
Taiki Endo
a8b662f643
ci: upgrade to new nightly (#4268) 2021-11-23 19:29:57 +09:00
Taiki Endo
fe770dc509
chore: fix newly added warnings (#4253) 2021-11-22 18:40:57 +09:00
Francis Murillo
909d3ec0ff
stream: add From<Receiver<T>> impl for receiver streams (#4080) 2021-08-29 16:30:13 +02:00
Nylonicious
84f6845bf2
stream: impl FromIterator for StreamMap (#4052) 2021-08-24 13:21:02 +02:00
Alice Ryhl
175d84e2b1
chore: fix doc failure in CI on master (#4020) 2021-08-03 09:07:38 +02:00
Alice Ryhl
69a6585429
signal: make windows docs for signal module show up on unix builds (#3770) 2021-08-02 20:55:17 +02:00
Blas Rodriguez Irizar
4818c2ed05
fs: document performance considerations (#3920) 2021-07-06 16:25:13 +02:00
oiovoyo
2e7de1ae1d
stream: modify HashMap to StreamMap in example. (#3925) 2021-07-05 16:10:55 +02:00
Alice Ryhl
37e60fc7f9
chore: fix new clippy complaint (#3915) 2021-07-05 09:58:49 +02:00
Alice Ryhl
8170e2787c
sync: fix watch wrapper (#3914) 2021-07-02 23:24:02 +02:00
Taiki Endo
08ed41f339
chore: fix typos (#3907) 2021-07-01 02:06:56 +09:00
Alice Ryhl
38204f5fba
time: fix Timeout size_hint (#3902) 2021-06-29 20:06:10 +02:00
Taiki Endo
c4b6b130f3
chore: bump nightly to nightly-2021-04-25 (#3754) 2021-05-05 17:39:17 +02:00
Chế Vũ Gia Hy
a945ce0996
stream: implement Error and Display for BroadcastStreamRecvError (#3745) 2021-05-05 11:15:42 +02:00
Marco Ieni
a08ce0d3e0
ci: check docs of private items (#3715) 2021-04-30 13:25:50 +02:00
Kai Jewson
69b129b405
stream: avoid yielding in AllFuture and AnyFuture (#3625) 2021-03-21 09:34:18 +01:00
Matthew James Briggs
8c5cde9bc3
stream: documentation note for throttle Unpin (#3600) 2021-03-10 08:39:43 +01:00
nickelc
704de8c01b
stream: remove duplicate doc(test(..)) & cfg_attr declarations (#3571) 2021-03-06 20:54:28 +09:00
Thomas Orozco
47be928444
sync: yield initial value in WatchStream (#3576) 2021-03-05 21:35:12 +01:00
Pirmin Kalberer
fd93ecf5e0
stream: remove duplicate doc_cfg declaration (#3561) 2021-02-27 22:47:26 +01:00
Taiki Endo
36d7dab504
chore: remove html_root_url (#3489)
Co-authored-by: Alice Ryhl <alice@ryhl.io>
2021-02-18 14:11:39 -08:00
Alice Ryhl
e827829402
signal: add Signal wrappers to tokio-stream (#3510) 2021-02-07 11:30:18 +01:00
Alice Ryhl
23fdc2b3c4
chore: prepare tokio-stream 0.1.3 (#3507) 2021-02-05 22:18:56 +01:00
Alice Ryhl
0a04954d5c
stream: update features and doc for broadcast/watch stream (#3504) 2021-02-05 20:39:27 +01:00
Fuyang Liu
1c1e0e3fc9
tokio-stream: add wrapper for broadcast and watch (#3384) 2021-02-05 19:56:24 +01:00
Alice Ryhl
766a89bf94
chore: prepare tokio-stream 0.1.2 (#3414) 2021-01-12 21:38:51 +01:00
Taiki Endo
d37486dd06
util: remove path deps (#3413)
* util: remove path deps

* ci: run clippy with --all-features

* ci: run tests with --all-features on FreeBSD CI
2021-01-13 00:19:57 +09:00
Alice Ryhl
4beb1862ac
chore: prepare tokio-stream 0.1.1 (#3374) 2021-01-04 19:46:01 +01:00
Alice Ryhl
7f17822ed9
stream: add Stream wrappers in tokio-stream (#3343) 2021-01-04 19:03:18 +01:00
Alice Ryhl
4d7b73f5b3
chore: create stream_ext module (#3342) 2020-12-26 17:05:51 +01:00
Taiki Endo
ce0e9c67cf
chore: Revert "use #[non_exhaustive] instead of private unit field" (#3323)
This reverts commit 575938d4579e6fe6a89b700aadb0ae2bbab5483b.
2020-12-23 08:27:58 -08:00
Taiki Endo
575938d457
chore: use #[non_exhaustive] instead of private unit field (#3320) 2020-12-23 22:48:33 +09:00
Lucio Franco
59e4b35f49
stream: Fix a few doc issues (#3285) 2020-12-17 10:35:49 -05:00
Carl Lerche
d74d17307d
time: remove Box from Sleep (#3278)
Removes the box from `Sleep`, taking advantage of intrusive wakers. The
`Sleep` future is now `!Unpin`.

Closes #3267
2020-12-16 21:51:34 -08:00
Lucio Franco
8efa62013b
Move stream items into tokio-stream (#3277)
This change removes all references to `Stream` from
within the `tokio` crate and moves them into a new
`tokio-stream` crate. Most types have had their
`impl Stream` removed as well in-favor of their
inherent methods.

Closes #2870
2020-12-15 20:24:38 -08:00