2
0
Fork 1
mirror of https://github.com/async-rs/async-std.git synced 2025-01-31 09:45:36 +00:00
Commit graph

1017 commits

Author SHA1 Message Date
Felipe Sere
83ff11ff4c Switch cycle to stream 2019-11-02 22:23:46 -05:00
Felipe Sere
e1ba87e7c1 Add slightly better docs 2019-11-02 22:23:46 -05:00
Felipe Sere
8126bb1882 use the module operator to calculate next index 2019-11-02 22:23:46 -05:00
Felipe Sere
486f9a964c Cycle over a known set of values. 2019-11-02 22:23:46 -05:00
Felipe Sere
a096d5ec2d stub out an example 2019-11-02 22:23:00 -05:00
Felipe Sere
dea1b67670 Skeleton cycle 2019-11-02 22:23:00 -05:00
Aleksey Kladov
fa91d7f856 Stream::merge does not end prematurely if one stream is delayed (#437)
* Stream::merge does not end prematurely if one stream is delayed

* `cargo test` without features works

* Stream::merge works correctly for unfused streams
2019-11-03 00:11:59 +01:00
Yoshua Wuyts
9a4f4c591c
Merge pull request #441 from async-rs/stdio-lock-unstable
mark stdio-lock structs as unstable
2019-11-03 00:05:11 +01:00
Yoshua Wuyts
6f9436e575
mark stdio-lock structs as unstable
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-11-02 23:54:27 +01:00
Yoshua Wuyts
735fa6954e Replace select!/try_select! with Future::{race,try_race} (#405)
* init Future::select

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* implement Future::select

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* try_select

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* fixes

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* works

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* pass clippy

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* please clippy

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* implement feedback from stjepan

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* rename select to race

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* fmt

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-11-02 23:00:03 +01:00
yjh
3a2e6d5b92 add max_by_key (#408)
* add max_by_key

* fix conflict

* fmt code
2019-11-02 15:59:15 +01:00
Zhang Guyu
5fb9d3e980 add Stream::copied (#442) 2019-11-02 15:58:30 +01:00
Yoshua Wuyts
4c63392a85
Merge pull request #334 from k-nasa/add_stdin_lock
Locking for stdin
2019-11-02 14:18:36 +01:00
k-nasa
3dcad984b4 fix: To unstable feature 2019-11-02 12:34:53 +09:00
Yoshua Wuyts
911ebada0b
Merge pull request #434 from paulocsanz/master
Put everything behind a 'stable' feature to avoid future breaking changes
2019-11-02 01:33:52 +01:00
Aleksey Kladov
ec1a6ea3e8 Fix typo (#439) 2019-11-01 22:08:19 +01:00
Tyler Neely
5adc608791 Spawn several threads when we fail to enqueue work in the blocki… (#181)
* Rebase onto master

* Switch to unbounded channels
2019-11-01 21:53:13 +01:00
k-nasa
81873ae5f3 fix 2019-11-02 01:27:27 +09:00
Paulo
8e991bcd3a Fix typo 2019-11-01 10:59:38 -03:00
Paulo
2e66c38453 Simplify default feature 2019-11-01 10:58:51 -03:00
k-nasa
0661f774c2 Merge branch 'master' into add_stdin_lock 2019-11-01 21:20:38 +09:00
k-nasa
2f3c867d44 Merge branch 'master' into stream_from_iter 2019-11-01 21:19:53 +09:00
k-nasa
063798ce49 Add doc 2019-11-01 21:18:43 +09:00
Yoshua Wuyts
a3b742188d fix doc tests (#431)
* fix doc tests

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* cargo fmt

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-11-01 12:54:43 +01:00
Paulo
dcd7c55cef Put everything behind a 'stable' feature 2019-11-01 00:41:38 -03:00
Stjepan Glavina
87de4e1598
Add utility type WakerSet to the sync module (#390)
* Add utility type Registry to the sync module

* Remove unused import

* Split unregister into complete and cancel

* Refactoring and renaming

* Split remove() into complete() and cancel()

* Rename to WakerSet

* Ignore clippy warning

* Ignore another clippy warning

* Use stronger SeqCst ordering
2019-11-01 02:45:50 +01:00
Stjepan Glavina
3dd59d7056
Refactor the task module (#421)
* Refactor the task module

* Fix clippy warning

* Simplify task-local entries

* Reduce the amount of future wrapping

* Cleanup

* Simplify stealing
2019-11-01 02:45:33 +01:00
k-nasa
caa23381f0 fix clippy warning 2019-11-01 10:41:21 +09:00
k-nasa
eeb44c86e9 fix 2019-11-01 10:34:28 +09:00
k-nasa
f8b8c9debe Merge branch 'master' into add_stdin_lock 2019-11-01 10:10:49 +09:00
Yoshua Wuyts
cc75b65b8c
Merge pull request #409 from yjhmelody/stream-min
Add Stream min
2019-11-01 00:41:54 +01:00
Yoshua Wuyts
f102588df5
Merge pull request #428 from zhangguyu6/stream-position
Add stream position
2019-11-01 00:33:39 +01:00
Yoshua Wuyts
3e0fe742f6
Merge pull request #427 from yjhmelody/stream-ne
Add stream ne
2019-11-01 00:29:21 +01:00
zhangguyu
07d21e5eb3 change trait bounds 2019-10-31 23:30:11 +08:00
zhangguyu
48c82a9668 Add stream position 2019-10-31 22:33:17 +08:00
yjhmelody
1ab3d901e4 fmt code 2019-10-31 21:17:07 +08:00
yjhmelody
204da33391 fmt code 2019-10-31 21:16:13 +08:00
yjhmelody
17db7ffcd3 Add stream ne 2019-10-31 20:18:53 +08:00
yjhmelody
f5efaaa7ba Add stream eq 2019-10-31 14:44:19 +08:00
Wu Yu Wei
ff6a44fcd5 Use once_cell instead of lazy_static (#416)
`once_cell` provides a neat way of initializing lazy singletons without
macro. This PR use `sync::Lazy` to streamline same pattern proposed in
related rust RFC.

Resolve #406
2019-10-30 11:23:08 +00:00
k-nasa
40c4e1a29d feat: Add stream::from_iter 2019-10-30 10:39:05 +09:00
k-nasa
2c91b30ee8 feat: Add Read and Write trait to Lock struct 2019-10-29 23:12:32 +09:00
yjhmelody
021862dcc8 fix min 2019-10-29 21:49:30 +08:00
yjhmelody
b942d0a405 add stream-min 2019-10-29 21:44:56 +08:00
Yoshua Wuyts
2b1c6f04ea
Merge pull request #384 from yjhmelody/stream-max_by
add stream::max_by method
2019-10-29 11:19:50 +01:00
Yoshua Wuyts
5ff4ef8dd4
Merge pull request #385 from yjhmelody/stream-min_by_key
add stream::min_by_key method
2019-10-29 11:18:34 +01:00
Yoshua Wuyts
f311e3de9f
Merge pull request #397 from async-rs/sync-docs
add mod level docs for sync
2019-10-29 11:07:56 +01:00
Yoshua Wuyts
3a06a1211b
Add feedback from review
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-29 10:56:33 +01:00
Yoshua Wuyts
526c4da21a
Merge pull request #395 from async-rs/stream-docs
add stream mod docs
2019-10-29 10:50:26 +01:00
Yoshua Wuyts
997e811c58
Merge pull request #402 from async-rs/fuse-docs
update Stream::fuse docs
2019-10-29 10:49:43 +01:00
Yoshua Wuyts
11d0577407
Merge pull request #396 from async-rs/net-docs
standardize net docs
2019-10-29 10:30:45 +01:00
Yoshua Wuyts
eb081b1948
Apply suggestions from code review
Co-Authored-By: Florian Gilcher <florian.gilcher@ferrous-systems.com>
2019-10-29 10:23:54 +01:00
k-nasa
35cb11e398 Merge branch 'master' into add_stdin_lock 2019-10-29 16:01:58 +09:00
Yoshua Wuyts
1175a37c47
Merge pull request #367 from k-nasa/add_stream_flatten
Add Stream::flatten and Stream::flat_map
2019-10-29 02:22:04 +01:00
k-nasa
1554b04407 $cargo fmt 2019-10-29 10:12:22 +09:00
k-nasa
1545d24e50 Merge branch 'master' into add_future_delay 2019-10-29 10:09:09 +09:00
k-nasa
ae7adf2c36 fix: Remove unused import 2019-10-29 10:01:41 +09:00
k-nasa
040227f38a Merge branch 'master' into add_stream_flatten 2019-10-29 09:58:10 +09:00
k-nasa
688976203e fix: Split FlattenCompat logic to Flatten and FlatMap 2019-10-29 09:52:50 +09:00
k-nasa
c7dc147f73 fix indent 2019-10-29 09:27:35 +09:00
Yoshua Wuyts
b3ae6f2b03
update Stream::fuse docs
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-28 13:02:13 +01:00
Yoshua Wuyts
4346386610
fix doc recursion limit
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-28 12:42:23 +01:00
Yoshua Wuyts
ca4856a0e8
Merge pull request #377 from ktomsic/sum-and-product-impls
Add `Stream::sum()` and `Stream::product()` implementations
2019-10-28 12:34:30 +01:00
Yoshua Wuyts
e5675151b9
Merge pull request #364 from stjepang/optimize-flushing
Don't flush files if they weren't written to
2019-10-28 12:19:15 +01:00
Yoshua Wuyts
fd940b8c6a
Merge pull request #348 from k-nasa/add_stream_timeout
Add stream timeout
2019-10-28 12:12:02 +01:00
Yoshua Wuyts
1baee98ead
Merge pull request #375 from sunjay/fromstream-pathbuf
Added Extend + FromStream for PathBuf
2019-10-28 10:34:48 +01:00
k-nasa
613895d6be doc: fix documantation text 2019-10-28 13:58:54 +09:00
Florian Gilcher
f262fd8a40
Merge pull request #392 from taiki-e/clippy
Remove usage of actions-rs/clippy-check
2019-10-27 20:26:43 -07:00
Florian Gilcher
c2a084ed4a
Merge pull request #393 from k-nasa/fix_clippy
Fix clippy warnings
2019-10-27 20:22:35 -07:00
Yoshua Wuyts
5f8e2cbd4a
add mod level docs for sync
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-28 00:34:27 +01:00
Yoshua Wuyts
20abd5cebf
standardize net docs
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-28 00:15:13 +01:00
Yoshua Wuyts
4c4604d63e
add stream mod docs
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-28 00:08:32 +01:00
Yoshua Wuyts
4475a229d6
backlink io docs
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-27 22:46:18 +01:00
Yoshua Wuyts
a3a740c14a
backlink all docs
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-27 22:29:20 +01:00
k-nasa
59615a655b feat: Add StderrLock and StdoutLock struct 2019-10-27 22:04:43 +09:00
k-nasa
fe49f2618f fix clippy::redundant_clone 2019-10-27 20:34:44 +09:00
k-nasa
7c293d37f7 fix clippy::comparison_chain 2019-10-27 20:32:22 +09:00
nasa
a42ae2f3d9
Narrow the disclosure range of FlattenCompat::new
Co-Authored-By: Taiki Endo <te316e89@gmail.com>
2019-10-27 12:35:51 +09:00
nasa
37f14b0195
Narrow the disclosure range of Flatten::new
Co-Authored-By: Taiki Endo <te316e89@gmail.com>
2019-10-27 12:35:32 +09:00
nasa
13a08b0d54
Narrow the disclosure range of FlatMap::new
Co-Authored-By: Taiki Endo <te316e89@gmail.com>
2019-10-27 12:35:14 +09:00
Johannes Weissmann
75546ef831 Merge branch 'master' into stream_count 2019-10-26 23:18:04 +02:00
Johannes Weissmann
6608d39c59 remove Stream trait bound 2019-10-26 21:58:34 +02:00
Taiki Endo
6549b66ad2 run clippy check on beta & address clippy warnings 2019-10-27 03:28:20 +09:00
yjhmelody
7cfec4e8ce use take and remove Copy 2019-10-27 00:26:19 +08:00
yjh
fb78ed1812
Update src/stream/stream/min_by_key.rs
Co-Authored-By: Taiki Endo <te316e89@gmail.com>
2019-10-27 00:19:49 +08:00
yjh
5a4fdeb1cd
Update src/stream/stream/min_by_key.rs
Co-Authored-By: Taiki Endo <te316e89@gmail.com>
2019-10-27 00:18:18 +08:00
yjh
b57849e1cb
Update src/stream/stream/max_by.rs
Co-Authored-By: Taiki Endo <te316e89@gmail.com>
2019-10-27 00:18:01 +08:00
yjh
a8d3d1483f
Update src/stream/stream/max_by.rs
Co-Authored-By: Taiki Endo <te316e89@gmail.com>
2019-10-27 00:17:50 +08:00
yjh
006fc7e9de
Update src/stream/stream/max_by.rs
Co-Authored-By: Taiki Endo <te316e89@gmail.com>
2019-10-27 00:17:42 +08:00
yjhmelody
c9e6d3a84c use pin_project_lite 2019-10-26 12:59:43 +08:00
yjhmelody
37a7eadf17 use pin_project_lite 2019-10-26 11:52:41 +08:00
yjhmelody
d0c3c9172b Merge branch 'master' of git://github.com/async-std/async-std into stream-max_by 2019-10-26 11:34:59 +08:00
k-nasa
61b7a09c70 Fix type declaration 2019-10-26 01:45:12 +09:00
nasa
8932cecec7
Update src/stream/stream/flatten.rs
Co-Authored-By: Taiki Endo <te316e89@gmail.com>
2019-10-26 01:43:14 +09:00
nasa
bf3508ffb2
Update src/stream/stream/flatten.rs
Co-Authored-By: Taiki Endo <te316e89@gmail.com>
2019-10-26 01:43:07 +09:00
nasa
6168952d6f
Update src/stream/stream/flatten.rs
Co-Authored-By: Taiki Endo <te316e89@gmail.com>
2019-10-26 01:42:57 +09:00
nasa
b7b5df13aa
Update src/stream/stream/flatten.rs
Co-Authored-By: Taiki Endo <te316e89@gmail.com>
2019-10-26 01:42:39 +09:00
nasa
7ce721f562
Update src/lib.rs
Co-Authored-By: Taiki Endo <te316e89@gmail.com>
2019-10-26 01:42:19 +09:00
k-nasa
b66ffa670e update recursion_limit 2019-10-26 00:42:27 +09:00
k-nasa
0c5abee284 to unstable stream::flat_map, stream::flatten 2019-10-26 00:36:04 +09:00
k-nasa
001368d3df $cargo fmt 2019-10-26 00:29:10 +09:00
k-nasa
00e7e58bf3 fix type def 2019-10-26 00:26:53 +09:00
k-nasa
271b6f4a1c fix: Using pin_project! 2019-10-25 23:58:08 +09:00
k-nasa
3297a0f327 Merge branch 'master' into add_stream_flatten 2019-10-25 23:34:44 +09:00
k-nasa
48b255897e Merge branch 'master' into add_stdin_lock 2019-10-24 18:34:42 +09:00
k-nasa
feeb3c10df fix: Remove Pin API related unsafe code 2019-10-24 08:41:01 +09:00
k-nasa
b17af61367 Merge branch 'master' into add_stream_timeout 2019-10-24 08:40:43 +09:00
k-nasa
d97b3dfdf3 fix: Remove Pin API related unsafe code 2019-10-24 08:29:05 +09:00
k-nasa
5c9cfb4fe8 Merge branch 'master' into add_future_delay 2019-10-24 08:23:01 +09:00
Wouter Geraedts
1fd05a157f Reset delay to prevent poll after ready 2019-10-23 22:34:39 +02:00
Wouter Geraedts
1c843a8124 Re-implemented Throttle to keep last value in memory 2019-10-23 22:27:51 +02:00
Stjepan Glavina
b2fe91385b
Add channel behind unstable feature flag (#380)
* Add channel behind unstable feature flag

* Don't check tests without unstable feature flag

* Fix typos

* Remove useless attribute
2019-10-23 17:02:03 +01:00
Taiki Endo
2abf5ca891
Deny warnings on CI (#378)
* Deny warnings on CI

* Fix some clippy warnings
2019-10-23 20:20:59 +09:00
yjhmelody
f5a0a0ba86 fmt 2019-10-23 19:17:24 +08:00
yjhmelody
d6f940110b update doc 2019-10-23 19:04:04 +08:00
yjhmelody
020eb85093 add stream::min_by_key method 2019-10-23 18:59:06 +08:00
Taiki Endo
944e43d4bf Remove Pin API related unsafe code by using pin-project-lite cra… (#381) 2019-10-23 10:35:02 +01:00
yjhmelody
4e5828e646 add stream::max_by method 2019-10-23 16:46:11 +08:00
Kyle Tomsic
e26eb7a719 Add Stream::sum() and Stream::product() implementations
These are the stream equivalents to `std::iter::Iterator::sum()` and
`std::iter::Iterator::product()`.

Note that this changeset tweaks the `Stream::Sum` and `Stream::Product`
traits a little: rather than returning a generic future `F`, they return
a pinned, boxed, `Future` trait object now. This is in line with other
traits that return a future, e.g. `FromStream`.
2019-10-22 20:30:27 -04:00
Sunjay Varma
0d4a907335 Added Extend + FromStream for PathBuf 2019-10-20 19:18:37 -04:00
Johannes Weissmann
97094b2a1c remove Sized constraint 2019-10-20 22:03:51 +02:00
Wouter Geraedts
ced5281b73 Merge remote-tracking branch 'upstream/master' into 342-stream-throttle 2019-10-20 16:50:31 +02:00
Johannes Weissmann
a9a7bdc290 add stream::count 2019-10-18 07:23:52 +02:00
k-nasa
410d16eaf6 Add docs + To unstable feature 2019-10-18 13:20:44 +09:00
k-nasa
1c1e2230f3 Merge branch 'master' into add_stream_flatten 2019-10-18 12:47:48 +09:00
k-nasa
176359afae Add Stream::flatten 2019-10-18 12:20:28 +09:00
k-nasa
8138afbfad feat: Add Stream trait for Flatten 2019-10-18 12:20:02 +09:00
k-nasa
cd862083a5 Add Flatten struct 2019-10-18 12:19:38 +09:00
k-nasa
2187a2a31d feat: Add Stream::flat_map 2019-10-18 10:43:36 +09:00
k-nasa
2dee289750 Add FlatMap struct 2019-10-18 10:43:21 +09:00
k-nasa
bb1416420d feat: Add Stream trait for FlattenCompat 2019-10-18 10:34:53 +09:00
Stjepan Glavina
8bef2e9e95 Don't flush files if they weren't written to 2019-10-17 21:28:38 +02:00
Stjepan Glavina
ec23632f3e
Cleanup: replace cfg-if with our macros (#361)
* Cleanup: replace cfg-if with our macros

* Prefix macros with cfg_

* Remove #[macro_export] from internal macros
2019-10-17 19:17:49 +02:00
k-nasa
ec98b41c85 feat: Add FlattenCompat struct 2019-10-17 23:56:01 +09:00
Stjepan Glavina
46f0fb1c64
Make sure each invocation of block_on uses its own Parker (#358) 2019-10-17 11:52:42 +02:00
k-nasa
f2bf01223c $cargo fmt 2019-10-17 16:34:39 +09:00
k-nasa
70e8476264 fix StdinLock doc test 2019-10-17 16:32:14 +09:00
k-nasa
a5a00d7b14 feat: Add StdinLock struct 2019-10-17 16:29:23 +09:00
Wouter Geraedts
a2393501c5 Implemented StreamExt::throttle 2019-10-16 18:43:34 +02:00
k-nasa
b58bd8d725 Merge branch 'add_stream_timeout' of https://github.com/k-nasa/async-std into add_stream_timeout 2019-10-16 23:08:23 +09:00
k-nasa
0a4073449b doc: Add Stream::Timeout doc 2019-10-16 22:56:48 +09:00
k-nasa
c3f6f969c5 fix: Rename TimeoutStream to Timeout 2019-10-16 22:56:17 +09:00
k-nasa
53fa132d13 fix type Declaration 2019-10-16 22:45:18 +09:00
k-nasa
9d55fff81d fix export FutureExt 2019-10-16 22:38:28 +09:00
nasa
f1ed034600
Update src/stream/stream/mod.rs
Co-Authored-By: Yoshua Wuyts <yoshuawuyts+github@gmail.com>
2019-10-16 22:21:32 +09:00
Yoshua Wuyts
9ff0750d4d
Merge pull request #353 from async-rs/fix-printing
fix print macros
2019-10-16 15:07:33 +02:00
Yoshua Wuyts
4d34a15363
fix macros, take II
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-16 14:35:10 +02:00
Yoshua Wuyts
822e4bc220
Merge branch 'master' into fs-stream-repeat-with 2019-10-16 14:26:20 +02:00
Yoshua Wuyts
6e0905d3ca correctly mark stream::Merge as unstable (#352)
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-16 14:13:35 +02:00
k-nasa
10f32ca817 Fix TimeoutError 2019-10-16 20:21:45 +09:00
Johannes Weissmann
aaa1b6ca39 add Stream::last (#347)
* add stream::LastFuture (not compiling)

Struggling with the associated type, pinning and how to move/copy
LastFuture.last.

* fix type signature -> still cannot assign

still problems assigning the new value to self.last

* remove unused bound

* add doctest

* unpin LastFuture.last

* RustFmt

* add static lifetime

* remove redundant lifetime
2019-10-16 13:14:54 +02:00
k-nasa
358d2bc038 Add import crate 2019-10-16 19:57:03 +09:00
Stjepan Glavina
add6863185
Fix typos 2019-10-16 12:24:18 +02:00
k-nasa
b251fc999a Move delay method to FutureExt::delay 2019-10-16 19:18:05 +09:00
Yoshua Wuyts
faff1f7370 task docs (#346)
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-16 10:28:14 +02:00
k-nasa
054f4fac74 feat: Add future::delay 2019-10-16 16:53:43 +09:00
k-nasa
7a87dea085 feat: Add Stream::timeout 2019-10-16 15:31:40 +09:00
k-nasa
f00d32ee7d Add TimeoutStream struct 2019-10-16 15:31:40 +09:00
Yoshua Wuyts
e986e7ba66
Merge pull request #345 from async-rs/io-docs
Io docs
2019-10-16 02:53:38 +02:00
Wouter Geraedts
6b00e5e66c Implemented StreamExt::try_fold (#344) 2019-10-16 02:32:27 +02:00
assemblaj
4b96ea1273 Adds Stream::cmp (#273)
* Adds cmp

* Fixes formatting

* cleans up examples

* attempts to fix rustdoc issue

* formats with cargo fmt

* Adds proper trait bounds for cmp
2019-10-16 02:23:41 +02:00
Yoshua Wuyts
d250eee556
port the std::io docs to async_std::io
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-16 02:15:20 +02:00
Yoshua Wuyts
9f8fa45dc7
io docs
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-16 02:03:26 +02:00
assemblaj
a7041be6f2 Adds Stream:ge (#285)
* Adds partial_cmp.rs file and partial_cmp signature to mod.rs

* adds tests that compare streams of same length

* Adds Stream::ge

* cargo fmt

* fixes rustdoc error
2019-10-16 01:24:27 +02:00
assemblaj
5f7238eec6 [Draft PR] Adds Stream::gt (#304)
* [Draft PR] Adds Stream::gt

* Applies cargo format and fixes incorrect comment

* cargo fmt

* fixes rustdoc related issues
2019-10-16 01:11:48 +02:00
assemblaj
f0f279ec04 Adds Stream::le (#336) 2019-10-16 00:46:06 +02:00
assemblaj
a8dc2c6f9b Adds Stream::lt (#337) 2019-10-16 00:32:54 +02:00
Yoshua Wuyts
24cdb2d489 add stream::{Sum,Product} (#343)
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-16 00:31:49 +02:00
Yoshua Wuyts
00d936488b stabilize future::timeout (#335)
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-15 16:33:23 +02:00
Yoshua Wuyts
49faea2023 init FutureExt (#308)
* init FutureExt

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* prelude

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* Refactor extension_trait

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* Fix rustdoc

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-15 16:27:06 +02:00
Yoshua Wuyts
d46364c834
Merge pull request #299 from async-rs/blocking-updates
Blocking updates
2019-10-15 16:17:07 +02:00
Yoshua Wuyts
237cfa0315 add IntoFuture (#259)
* add IntoFuture

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* blanket impl for IntoFuture

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* cargo fmt

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* example

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* mark as unstable

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-15 16:03:49 +02:00
Yoshua Wuyts
33806ad44c
fix warning
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-15 16:01:26 +02:00
Yoshua Wuyts
12fdc1232d
rename task::blocking to task::spawn_blocking
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-15 16:01:26 +02:00
Yoshua Wuyts
b4c1c63fd2
task::blocking async closure -> FnOnce
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-15 16:01:24 +02:00
Yoshua Wuyts
1a3429655c
init blocking-updates
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-15 16:00:15 +02:00
Fedor Sakharov
23beab4125 Adds a from_fn stream implementation (#277)
* Adds a from_fn stream implementation

* Update src/stream/from_fn.rs

Co-Authored-By: Yoshua Wuyts <yoshuawuyts+github@gmail.com>

* Fix review nits

* Use async_std Mutex
2019-10-15 15:50:17 +02:00
Yoshua Wuyts
e938527f66 add stream::interval (#298)
* add stream::interval

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* fix tests

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* cargo fmt

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* cross-docs

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* update deps

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-15 15:30:24 +02:00
k-nasa
94ef3dc2b2 feat: Add Stdout::lock 2019-10-15 21:44:23 +09:00
k-nasa
9b09806593 feat: Add Stdin::lock 2019-10-15 21:44:11 +09:00
k-nasa
f9741e7488 feat: Add Stderr::lock 2019-10-15 21:43:54 +09:00
Wouter Geraedts
c7f6543502 Inline TryFutureExt logic for src/io/timeout.rs (#317) 2019-10-15 09:56:39 +02:00
Yoshua Wuyts
1819408b46 add stream::ExactSizeStream as unstable (#330)
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-15 09:51:53 +02:00
Johannes Weissmann
6be8467cdc impl Stream::take_while adapter (#332)
* impl take_while stream adapter

* fmt

* add comment

* unindent where clauses
2019-10-15 09:50:03 +02:00
Yoshua Wuyts
529a58a066
Merge pull request #327 from assemblaj/assemblaj-partial_cmp_final
Adds Stream::partial_cmp
2019-10-15 03:45:21 +02:00
Yoshua Wuyts
00a8433338
Merge pull request #320 from Wassasin/183-async-path
Implement async Path & PathBuf
2019-10-15 02:51:55 +02:00
Stjepan Glavina
aa13ba758b Refactor 2019-10-15 02:05:23 +02:00
Stjepan Glavina
5c1e0522b7 Fix failing tests 2019-10-15 01:33:36 +02:00
Stjepan Glavina
504f8cb137 Use crate::path everywhere 2019-10-15 01:25:20 +02:00
Stjepan Glavina
f9cfee9e2c Formatting 2019-10-15 01:11:32 +02:00
Stjepan Glavina
0adcb50f58 Add ToOwned and Borrow impls 2019-10-15 01:08:12 +02:00
Wouter Geraedts
ba87048db5 Implemented our own Path::ancestors iterator 2019-10-14 22:00:45 +02:00
assemblaj
80bee9a215 Adds Stream::partial_cmp 2019-10-14 11:43:00 -04:00
Yoshua Wuyts
612a94b31e Add process submodule as unstable (#310)
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-14 15:51:47 +02:00
Yoshua Wuyts
e1deaa58d8 Add BufRead::split (#312)
* add BufRead::split

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* fix docs

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* Update src/io/buf_read/mod.rs

Co-Authored-By: Stjepan Glavina <stjepang@gmail.com>
2019-10-14 15:49:54 +02:00
Yoshua Wuyts
5f52efe465
Merge pull request #324 from async-rs/stabilize-future-join
stabilize future::{join,try_join}
2019-10-14 15:31:55 +02:00
Yoshua Wuyts
a9950c5c9f stabilize task::ready! (#325)
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-14 15:06:24 +02:00
Yoshua Wuyts
fe88da4e64 make all print macros unstable (#322)
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-14 14:48:12 +02:00
Yoshua Wuyts
9b0e02dbb7
Merge pull request #326 from async-rs/fused-stream
add stream::FusedStream as "unstable"
2019-10-14 14:22:41 +02:00
Yoshua Wuyts
d6aa1fb501 Add task::yield_now as "unstable" (#300)
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-14 13:58:26 +02:00
Yoshua Wuyts
3ac4575d94
add stream::FusedStream
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-14 02:21:27 +02:00
Yoshua Wuyts
05ba07daf8
stabilize future::{join,try_join}
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-14 01:52:10 +02:00
Yoshua Wuyts
454018ef42
Merge pull request #321 from async-rs/stream_merge
rename stream::join to Stream::merge
2019-10-14 01:46:42 +02:00
Yoshua Wuyts
04342c7b5d
docs
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-13 22:05:11 +02:00
Yoshua Wuyts
b601bcfcb8
polish
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-13 21:55:19 +02:00
Yoshua Wuyts
84a148ddae
rename stream::join to Stream::merge
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-13 21:48:53 +02:00
Wouter Geraedts
8df55dd015 Implemented PathBuf::set_file_name 2019-10-13 21:46:04 +02:00
Wouter Geraedts
54c94b717c Implemented PathBuf::set_extension 2019-10-13 21:41:16 +02:00
Wouter Geraedts
cc417cc001 Implemented PathBuf::push 2019-10-13 21:38:47 +02:00
Wouter Geraedts
07f9e48579 Implemented PathBuf::pop 2019-10-13 21:29:35 +02:00
Wouter Geraedts
71125d5c3b Implemented PathBuf::new 2019-10-13 21:19:23 +02:00
Wouter Geraedts
47ef222dab Implemented PathBuf::into_os_string 2019-10-13 21:13:01 +02:00
Yoshua Wuyts
a2baa1d8e0
rename stream::join to stream::merge
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-13 21:12:05 +02:00
Wouter Geraedts
80eaa28552 Implemented PathBuf::into_boxed_path 2019-10-13 21:11:42 +02:00
Wouter Geraedts
1bd17f11f2 Implemented PathBuf::as_path 2019-10-13 21:04:47 +02:00
Wouter Geraedts
409a10a8b5 Implemented Path::with_file_name 2019-10-13 20:55:56 +02:00
Wouter Geraedts
3c24b1891b Implemented Path::with_extension 2019-10-13 20:54:08 +02:00
Wouter Geraedts
a17b017e01 Implemented Path::to_string_lossy 2019-10-13 20:49:57 +02:00
Wouter Geraedts
ea43d7fd29 Implemented Path::to_str 2019-10-13 20:46:51 +02:00
Wouter Geraedts
df53a07fc5 Implemented Path::strip_prefix 2019-10-13 20:45:06 +02:00
Wouter Geraedts
942403c52c Implemented Path::starts_with 2019-10-13 20:14:07 +02:00
Wouter Geraedts
d349333a43 Implemented Path::read_link 2019-10-13 20:12:57 +02:00
Wouter Geraedts
89f73d3eda Implemented Path::read_dir 2019-10-13 19:57:46 +02:00
Yoshua Wuyts
fef2e32a3c
cargo fmt
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-13 19:54:44 +02:00
Yoshua Wuyts
467b64b6e7
doc fmt
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-13 19:54:44 +02:00
Yoshua Wuyts
296d0d9d31
add print macros
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-13 19:54:44 +02:00
Yoshua Wuyts
04479b13c3
add io::stdio
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-13 19:54:44 +02:00
Yoshua Wuyts
33da049717
Merge pull request #311 from async-rs/missing-write-methods
Add Write::write_fmt
2019-10-13 19:53:04 +02:00
Wouter Geraedts
141954d205 Implemented Path::parent 2019-10-13 19:38:33 +02:00
Wouter Geraedts
cc57db02a3 Implemented Path::join 2019-10-13 19:33:55 +02:00
Wouter Geraedts
0c03b92373 Implemented Path::iter 2019-10-13 19:31:17 +02:00
Wouter Geraedts
5d87006006 Implemented Path::is_relative 2019-10-13 19:16:52 +02:00
Wouter Geraedts
df9a01f534 Implemented Path::is_file 2019-10-13 19:15:15 +02:00
Wouter Geraedts
20f58ea1c1 Implemented Path::is_absolute 2019-10-13 19:10:16 +02:00
Wouter Geraedts
3a9597cd32 Implemented Path::has_root 2019-10-13 19:07:12 +02:00
Wouter Geraedts
28e936f6fe Implemented Path::file_stem 2019-10-13 19:05:18 +02:00
Wouter Geraedts
a6e1abecfc Implemented Path::file_name 2019-10-13 19:03:33 +02:00
Wouter Geraedts
a7eaae91ae Implemented Path::extension 2019-10-13 19:00:34 +02:00
Wouter Geraedts
4070833482 Implemented Path::ends_with 2019-10-13 18:58:36 +02:00
Wouter Geraedts
5235cd58be Implemented Path::display 2019-10-13 18:56:26 +02:00
Wouter Geraedts
759e357bea Implemented Path::ancestors 2019-10-13 18:54:36 +02:00
Wouter Geraedts
a57ba7ece0 Implemented Path::into_path_buf 2019-10-13 18:49:57 +02:00
Wouter Geraedts
6c6106a292 Implemented Path::{metadata, symlink_metadata} 2019-10-13 14:17:33 +02:00
Wouter Geraedts
6bbfd039b1 Fixed various tests 2019-10-13 14:11:41 +02:00
Wouter Geraedts
e690b55b18 Implemented fs::metadata and Path::exists 2019-10-13 13:52:58 +02:00
Wouter Geraedts
930b81868d Use std variants of Path and PathBuf internally 2019-10-13 13:46:02 +02:00
Wouter Geraedts
3bd6a9df6d Implemented components 2019-10-13 13:39:12 +02:00
Yoshua Wuyts
28b0ebe83a
Merge pull request #315 from k-nasa/add_flush_to_into_inner
Add BufWriter::into_inner flush
2019-10-13 13:38:22 +02:00
Wouter Geraedts
e27b578c27 WIP init Path and PathBuf async stubs 2019-10-13 13:06:39 +02:00
k-nasa
9d9543c46b refactor: Remove needless main fn 2019-10-13 16:33:02 +09:00
k-nasa
13ff627b09 $cargo fmt 2019-10-13 16:02:02 +09:00
k-nasa
ad156b1fce feat: Add BufWriter::into_inner flush 2019-10-13 15:55:32 +09:00
Yoshua Wuyts
b62e4a1e48
update desc
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-13 02:39:14 +02:00
Yoshua Wuyts
a1cd76e244
cargo fmt
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-13 01:36:44 +02:00
Yoshua Wuyts
f3eba1fb48
comments
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-13 01:35:16 +02:00
Yoshua Wuyts
570dedd712
cleanup
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-13 01:31:51 +02:00
Yoshua Wuyts
58c3a06a14
init write_fmt
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-13 01:29:17 +02:00
Yoshua Wuyts
483ded0e1c
fix example
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-12 01:38:53 +02:00
Yoshua Wuyts
064fdf020f
Stream::delay
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-12 01:35:41 +02:00
Yoshua Wuyts
30b5ca5851
Merge pull request #296 from stjepang/cleanup-bufwriter
Cleanup BufWriter
2019-10-10 15:51:50 +02:00
Yoshua Wuyts
9c32133f77
Merge pull request #295 from stjepang/cleanup-tosocketaddrs
Cleanup ToSocketAddrs, add more net reexports
2019-10-09 22:39:35 +02:00
Stjepan Glavina
de01a5c5b7 Stabilize io::Cursor 2019-10-09 17:19:34 +02:00
Stjepan Glavina
c890de2c52 Fix failing doc example 2019-10-09 14:49:31 +02:00
Stjepan Glavina
da2335bd57 Cleanup BufWriter 2019-10-09 14:45:40 +02:00
Stjepan Glavina
cbd458b1db Cleanup ToSocketAddrs, add more net reexports 2019-10-09 14:26:14 +02:00
Yoshua Wuyts
fc904a22cd
add task::blocking docs
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-09 13:03:38 +02:00
Yoshua Wuyts
9ab7b1ae6e
Merge pull request #251 from async-rs/blocking-unstable
add an unstable `task::blocking` function
2019-10-09 12:32:44 +02:00
Yoshua Wuyts
460b8af50b
Merge pull request #287 from k-nasa/optimizing_allocations
Optimizing allocations using Stream::size_hint
2019-10-08 17:18:51 +02:00
Yoshua Wuyts
c27623c0fd
cargo fmt
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-08 14:58:39 +02:00
Yoshua Wuyts
647aab819f
impl feedback
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-08 14:55:09 +02:00
Yoshua Wuyts
df15c04f28
spawn_blocking -> blocking
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-08 14:24:37 +02:00
k-nasa
1c798387bf $cargo fmt 2019-10-08 10:50:30 +09:00
k-nasa
9cede7f1e3 refactor: optimizing allocations 2019-10-08 00:06:49 +09:00
Miloš Vučenović
c3e38150e4 Fix uds listener hanging on accept (#272)
* Fix uds listener hanging on accept

UDS listener was hanging because the accept method would return
`Poll::Pending` without registering the task to be awoken in the case
when underlying unix listener returns a WouldBlock that gets converted
to None. This is a hacky fix for this case.

Should fix #248

* Test simulating uds ping-pong server/client

This one should reproduce #248 bug to prevent further regressions.

* Code review fixes
2019-10-07 16:49:42 +02:00
Yoshua Wuyts
5f708f3c4f
Merge pull request #270 from k-nasa/fix_clippy_warn
Fix clippy warning
2019-10-07 15:43:20 +02:00
Yoshua Wuyts
46ffe6ab63
Merge pull request #278 from Michael-J-Ward/fix-readme
Fixes feature flag used in generating the docs in the README
2019-10-07 15:41:04 +02:00
Michael J Ward
75b6c60c67 Corrects a cfg feature declaration in task/mod.rs 2019-10-06 12:00:02 -05:00
bors[bot]
ddee47231a
Merge #282
282: init path submodule as unstable r=yoshuawuyts a=yoshuawuyts

Ref #183.

Similar to #257 this adds the `path` submodule as unstable. Filling in all re-exports from std for module completion. From there the we can build out `Path` and `PathBuf` accordingly. Thanks!

Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-06 13:10:35 +00:00
Yoshua Wuyts
5b05846fb0
init path submodule as unstable
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-10-06 13:42:55 +02:00
Fedor Sakharov
49d123c7f9
Fix review nits 2019-10-06 08:32:44 +03:00
Fedor Sakharov
2384df11ed
Apply suggestions from code review
Co-Authored-By: Yoshua Wuyts <yoshuawuyts+github@gmail.com>
2019-10-06 08:27:44 +03:00
k-nasa
1c9d7895df doc: Add FromStream document 2019-10-06 13:08:35 +09:00
Fedor Sakharov
735d604cd1
Adds stream::repeat_with 2019-10-05 22:17:21 +03:00
Sunjay Varma
f968c9a540 rustfmt 2019-10-04 10:09:06 -04:00
Sunjay Varma
2cf3f3f566 FromStream for Arc<[T]> and Rc<[T]> 2019-10-04 10:09:06 -04:00
Sunjay Varma
63c6b1cb63 impl FromStream for Box<[T]> 2019-10-04 10:09:06 -04:00
Sunjay Varma
8e12798038 impl FromStream for Cow<[T]> 2019-10-04 10:09:06 -04:00
Sunjay Varma
b2174576b2 Added FromStream + Extend for LinkedList 2019-10-04 10:09:06 -04:00
Sunjay Varma
bd0808eedd Added FromStream + Extend for BinaryHeap 2019-10-04 10:09:06 -04:00
Sunjay Varma
3160dc8189 Added FromStream + Extend for BTreeSet 2019-10-04 10:09:06 -04:00
Sunjay Varma
6c2ffd7181 Added FromStream + Extend for HashSet 2019-10-04 10:09:06 -04:00
Sunjay Varma
333f35338e Added FromStream and Extend impls for HashMap 2019-10-04 10:09:06 -04:00
Sunjay Varma
de2bc1e83b Added FromStream + Extend for BTreeMap 2019-10-04 10:09:06 -04:00
Sunjay Varma
244c5159df Simplifying + optimizing Extend impl for Vec 2019-10-04 10:09:06 -04:00
Sunjay Varma
ae146afffc FromStream + Extend for VecDeque 2019-10-04 10:09:06 -04:00
Sunjay Varma
6bc3cd0ab2 FromStream for () 2019-10-04 10:08:07 -04:00
bors[bot]
6ab154be7c
Merge #266
266: Changes Extend trait in order to allow streams that yield references r=yoshuawuyts a=sunjay

This is not ready to merge yet. I am mainly opening it so we can discuss a change I had to make to the `Extend` trait. cc @yoshuawuyts @stjepang (and anyone else interested)

## Before this can be merged

- [x] Discuss/Approve changes to `Extend` trait
- [x] Change to using `for_each` after #264 is merged
- [ ] (optional) Wait until a `copied()` method is added to `StreamExt` so that the `&char` impl can be finished.
    - We can also just comment out or remove the impl that uses `copied` until that is added

## Changes To The Extend Trait

While writing the impls of the `Extend` trait for the `String` type, I noticed that certain impls weren't possible because there is no bound on `Extend` that guarantees that the type `A` being yielded from the stream actually lives long enough. We probably didn't run into this earlier because this usually isn't a problem for owned values since the compiler doesn't have to worry about whether they will out live the stream that they come from. I ran into this because of the `Extend` impls that consume streams of references.

The difference between the async `Extend` and the standard library `Extend` is that the async `Extend` returns a value that still references the input stream. That means that if `A` is any reference type, the compiler needs to be able to guarantee that `A` will be around as long as the `Future` returned from the trait method is around.

To fix this, I had to add the bound shown below:

```patch
 pub trait Extend<A> {
     /// Extends a collection with the contents of a stream.
     fn stream_extend<'a, T: IntoStream<Item = A> + 'a>(
         &'a mut self,
         stream: T,
-    ) -> Pin<Box<dyn Future<Output = ()> + 'a>>;
+    ) -> Pin<Box<dyn Future<Output = ()> + 'a>> where A: 'a;
 }
```

This guarantees that each value of type `A` will last at least as long as our boxed future does. The bound had to be in a where clause on the method (and not on the declaration of `A` because the lifetime `'a` isn't in scope at the trait level. I don't think there are any negative consequences of using a where clause like this, but that's why I wanted to bring it up for discussion.

In addition to this, I had to ensure that when writing the `Extend` impls for `String` I appropriately bounded the lifetime of the references from the stream. You can see this in the code below with `where 'b: 'a`.

```rust
impl<'b> Extend<&'b str> for String {
    fn stream_extend<'a, S: IntoStream<Item = &'b str> + 'a>(
        &'a mut self,
        stream: S,
    ) -> Pin<Box<dyn Future<Output = ()> + 'a>> where 'b: 'a {
        //TODO: This can just be: stream.into_stream().for_each(move |s| self.push_str(s))
        Box::pin(stream.into_stream().fold((), move |(), s| self.push_str(s)))
    }
}
```

I should note that initially I tried to make it work with just the impl shown above, without modifying the `Extend` trait. This doesn't work because it would be a stricter bound than what is found in the trait itself. Rust does not allow stricter bounds like that because it could potentially cause unsoundness when dealing with generics.

Of course, I am totally open to being completely wrong in my understanding of how to resolve this issue. I tried to solve the problem with as minimal of a change as possible. Please let me know if you have some better ideas or other suggestions.

## `FromStream` impls for String

The purpose of adding these `Extend` impls is to continue my work from #129 in adding the rest of the `FromStream` impls. The `Extend` impls are used directly to add all of the `FromStream` impls for `String`. Just like with #207 and #265, this adds a new `string` module that is unstable just like the other modules added for `FromStream`.

Co-authored-by: Sunjay Varma <varma.sunjay@gmail.com>
2019-10-04 13:55:33 +00:00
Yoshua Wuyts
5bd6acde46
Merge pull request #263 from montekki/fs-stream-map
Adds stream map combinator
2019-10-03 00:45:27 +02:00
Yoshua Wuyts
50b6d0b15f
Merge pull request #269 from montekki/fs-stream-try-for-each
Adds try_for_each combinator
2019-10-02 19:36:04 +02:00
Sunjay Varma
09a15ef116 Implementing Extend for String in terms of for_each now that that's been added 2019-10-01 22:39:57 -04:00
Sunjay Varma
d6f16b6a17 rustfmt 2019-10-01 22:31:29 -04:00
Sunjay Varma
b878855bc3 **CHANGES** extend trait in order to allow FromStream impls for String 2019-10-01 22:31:29 -04:00
bors[bot]
98c79f4ff9
Merge #255
255: Update futures-preview to 0.3.0-alpha.19 r=skade a=taiki-e

Depends on https://github.com/rustasync/surf/pull/74

Refs:
* https://github.com/rust-lang-nursery/futures-rs/issues/1761
* https://github.com/rust-lang-nursery/futures-rs/pull/1845


cc @skade @stjepang @yoshuawuyts 

Co-authored-by: Taiki Endo <te316e89@gmail.com>
2019-10-01 21:15:00 +00:00
Fedor Sakharov
35ab65fe8e
Fix docs 2019-10-01 20:07:56 +03:00
Fedor Sakharov
f4e2302e7e
Don't use Try trait, use Result instead 2019-10-01 18:08:39 +03:00
Yoshua Wuyts
a97a1fffff
Merge pull request #264 from montekki/fs-stream-for-each
Adds for_each stream combinator
2019-10-01 15:32:36 +02:00
k-nasa
cc21bdf068 $cargo fmt 2019-10-01 18:08:24 +09:00
k-nasa
c31861aa65 rafactor if expression 2019-10-01 18:08:24 +09:00
k-nasa
f08fcd0bbb refactor 2019-10-01 18:08:24 +09:00
k-nasa
87b272f83d refacotr: Refactor match expression 2019-10-01 18:08:24 +09:00
k-nasa
2460f35768 fix: Remove unnecessary Borrowed
Each implements a Copy trait
2019-10-01 18:08:24 +09:00
k-nasa
468cb6348f fix: Remove unnecessary &mut 2019-10-01 18:08:24 +09:00
k-nasa
6253e97717 feat: Add Default trait 2019-10-01 18:08:24 +09:00
Fedor Sakharov
66d38f7856
Adds try_for_each combinator 2019-10-01 10:39:43 +03:00
Sunjay Varma
a05b564486 rustfmt 2019-09-30 20:14:16 -04:00
Sunjay Varma
fb7582bd7a Using Box::pin(...) instead of Pin::from(Box::new(...)) 2019-09-30 19:42:30 -04:00
Sunjay Varma
ab7129cd45 FromStream for Vec<T> in terms of Extend 2019-09-30 19:42:30 -04:00
Sunjay Varma
76b10c4784 FromStream for Option<T> 2019-09-30 19:42:30 -04:00
Fedor Sakharov
6da7efc5ac
Adds for_each stream combinator 2019-09-30 23:45:00 +03:00
Fedor Sakharov
658a16bebe
Adds stream map combinator 2019-09-30 23:17:25 +03:00
Yoshua Wuyts
06862d47c3
update Barrier example to match std::sync::Barrier 1:1
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-29 04:21:48 +02:00
Taiki Endo
f0bf66d0df Update futures-preview to 0.3.0-alpha.19 2019-09-29 00:38:49 +09:00
dignifiedquire
064b44f695 apply cr 2019-09-27 18:49:23 -06:00
Yoshua Wuyts
958d3a9e27
add an unstable task::spawn_blocking function
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-28 01:37:17 +02:00
dignifiedquire
a1aa3f823d finish BufRead 2019-09-27 18:59:30 +02:00
dignifiedquire
dc6c8fb131 feat(io): add stub for BufRead for Take 2019-09-27 16:36:55 +02:00
dignifiedquire
d9aec105a1 feat(io): implement Read::chain 2019-09-27 16:30:38 +02:00
dignifiedquire
e681e297ef feat(io): implement Read::bytes 2019-09-27 15:14:24 +02:00
dignifiedquire
f751ebb8c4 feat(io): implement Read::by_ref 2019-09-27 15:10:40 +02:00
dignifiedquire
75dc819b2f feat(io): implement Read::take 2019-09-27 15:07:05 +02:00
bors[bot]
f6a2393fb5
Merge #241
241: Simplify extension traits using a macro r=yoshuawuyts a=stjepang

This PR would fix #235 

Async methods in our extension traits are now written in the simpler `-> impl Future<Output = T> [ConcreteFuture<Self>]` style. At the same time, doc tests are used even when the `docs` feature is not enabled.

Co-authored-by: Stjepan Glavina <stjepang@gmail.com>
2019-09-27 11:36:32 +00:00
Stjepan Glavina
414fadd6e6 cargo fmt 2019-09-26 23:13:02 -04:00
Yoshua Wuyts
70069e0014
future docs
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-27 01:07:55 +02:00
Stjepan Glavina
8e32fd09f3 Fix a doc test 2019-09-26 14:31:02 -04:00
Stjepan Glavina
ff028bb540 Improve compile times and add comments 2019-09-26 14:21:27 -04:00
Yoshua Wuyts
0b39306b74
fix barrier tests
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-26 17:24:24 +02:00
Yoshua Wuyts
c23cc769ee
mark sync::Barrier as unstable
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-26 16:34:44 +02:00
Stjepan Glavina
79eab9eb9a Simplify extension traits using a macro 2019-09-26 07:46:29 -04:00
dignifiedquire
b77b72d333 feat: implement sync::Barrier
Based on the implementation in https://github.com/tokio-rs/tokio/pull/1571
2019-09-25 21:10:06 +02:00
Yoshua Wuyts
785371cbc4
Merge pull request #187 from async-rs/join-macros
add future::{join,try_join,select,try_select} macros
2019-09-24 22:18:26 +02:00
Yoshua Wuyts
553e48057f
Merge pull request #133 from yoshuawuyts/ready_macro
expose `task::ready!`
2019-09-24 22:16:20 +02:00
Kirill Mironov
63154f5b7a cargo fmt 2019-09-24 16:33:02 +03:00
Kirill Mironov
d23af83189 removed LineWriter and implemented requested changes
Signed-off-by: Kirill Mironov <k.mironov@albato.ru>
2019-09-24 15:59:46 +03:00
Kirill Mironov
9509a056bd Merge branch 'master' into buf-writer 2019-09-24 15:03:55 +03:00
Stjepan Glavina
293d992de1 Fix stream_extend compilation failures 2019-09-24 05:13:02 +02:00
Yoshua Wuyts
a1bc097ffd
Merge pull request #211 from tirr-c/stream-extend
Add stream::Extend
2019-09-23 00:14:29 +02:00
Stjepan Glavina
c62b7a0ba9 Fix warnings 2019-09-22 17:06:00 +02:00
Stjepan Glavina
73d7fea937 Re-export Stream from futures 2019-09-22 16:51:18 +02:00
bors[bot]
33ff41df48
Merge #224
224: Re-export IO traits from futures r=stjepang a=stjepang

Sorry for the big PR!

Instead of providing our own traits `async_std::io::{Read, Write, Seek, BufRead}`, we now re-export `futures::io::{AsyncRead, AsyncWrite, AsyncSeek, AsyncRead}`. While re-exporting we rename them to strip away the "Async" prefix.

The documentation will display the contents of the original traits from the `futures` crate together with our own extension methods. There's a note in the docs saying the extenion methods become available only when `async_std::prelude::*` is imported.

Our extension traits are re-exported into the prelude, but are marked with `#[doc(hidden)]` so they're completely invisible to users.

The benefit of this is that people can now implement traits from `async_std::io` for their types and stay compatible with `futures`. This will also simplify some trait bounds in our APIs - for example, things like `where Self: futures_io::AsyncRead`.

At the same time, I cleaned up some trait bounds in our stream interfaces, but haven't otherwise fiddled with them much.

I intend to follow up with another PR doing the same change for `Stream` so that we re-export the stream trait from `futures`.

Co-authored-by: Stjepan Glavina <stjepang@gmail.com>
2019-09-22 13:50:53 +00:00
Stjepan Glavina
17534cfffc Fuse next() future 2019-09-22 15:19:54 +02:00
Fedor Sakharov
2a2a473889
adds stream::chain combinator 2019-09-22 15:48:12 +03:00
Stjepan Glavina
d55cfb1da8 impl FusedStream for Fuse 2019-09-22 12:44:46 +02:00
Stjepan Glavina
797a6b2d90 Add a missing assert in a doc example 2019-09-22 12:16:35 +02:00
Stjepan Glavina
bfab20da03 Don't re-export ext traits in async_std::io 2019-09-22 12:08:08 +02:00
Fedor Sakharov
89fd473da0
fixes merge artifacts in stream docs 2019-09-22 09:51:54 +03:00
bors[bot]
a8e48b1542
Merge #226
226: adds stream::step_by combinator r=stjepang a=montekki

Ref: #129 
Stdlib: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.step_by

Co-authored-by: Fedor Sakharov <fedor.sakharov@gmail.com>
2019-09-21 16:46:50 +00:00
Fedor Sakharov
376049b51d
Merge branch 'master' into fs-stream-step-by 2019-09-21 19:07:27 +03:00
Fedor Sakharov
bf7121d2d4
adds stream::inspect combinator 2019-09-21 18:19:47 +03:00
Fedor Sakharov
e74c0cec1f
adds stream::step_by combinator 2019-09-21 17:44:57 +03:00
Fedor Sakharov
ea080e7305
Merge branch 'master' into fs-stream-skip-while 2019-09-21 17:42:44 +03:00
bors[bot]
99724497b3
Merge #221
221: adds stream::filter combinator r=stjepang a=montekki

Ref: #129 
Stdlib: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.filter

Co-authored-by: Fedor Sakharov <fedor.sakharov@gmail.com>
2019-09-21 14:22:58 +00:00
bors[bot]
47ce009e10
Merge #222
222: adds stream::skip combinator r=stjepang a=montekki

Ref: #129 
Stdlib: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.skip

Co-authored-by: Fedor Sakharov <fedor.sakharov@gmail.com>
2019-09-21 13:46:11 +00:00
Fedor Sakharov
fdd81e1b2a
Actually export Skip 2019-09-21 16:40:58 +03:00
Fedor Sakharov
e430851bc4
export Filter type 2019-09-21 16:40:01 +03:00
Fedor Sakharov
75da138696
export Skip type 2019-09-21 16:37:30 +03:00
Fedor Sakharov
93463e8df3
export SkipWhile type 2019-09-21 16:34:51 +03:00
Stjepan Glavina
53ce30ae66
Fix async_std imports in metadata.rs 2019-09-21 15:17:49 +02:00
Stjepan Glavina
1fa196812a Fix compilation errors around Stream 2019-09-21 15:05:57 +02:00
Stjepan Glavina
edfa2358a4 Re-export IO traits from futures 2019-09-21 14:30:52 +02:00
Fedor Sakharov
f9f97c43c4
adds stream::skip_while combinator 2019-09-21 15:12:41 +03:00
Fedor Sakharov
570329b176
adds stream::skip combinator 2019-09-21 14:40:25 +03:00
Fedor Sakharov
e7ae10ebee
adds stream::filter combinator 2019-09-21 14:03:17 +03:00
Yoshua Wuyts
fa31c6347e
expose sync::{Arc,Weak}
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-19 18:28:17 +02:00
Yoshua Wuyts
42fac26761
fix unstable display for pin docs
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-19 16:02:28 +02:00
Yoshua Wuyts
7fe6c8a42c
add stream::join
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-19 13:53:36 +02:00
Wonwoo Choi
9c00d0b903 Rename: extend_with_stream => stream_extend 2019-09-19 18:34:31 +09:00
Wonwoo Choi
a5a6dc24c4 Add stream::Extend 2019-09-19 18:33:25 +09:00
bors[bot]
91f002d12b
Merge #209
209: add feature guards for unstable features r=yoshuawuyts a=yoshuawuyts

Makes sure unstable features aren't accidentally usable without their corresponding flags. Thanks!

Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
Co-authored-by: Yoshua Wuyts <yoshuawuyts+github@gmail.com>
2019-09-18 21:53:20 +00:00
Yoshua Wuyts
c533d5f906
implement feedback & fix tests
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-18 21:25:58 +02:00
Stjepan Glavina
bfd7af8775 Rename local.rs -> task_local.rs 2019-09-18 13:59:32 +02:00
Yoshua Wuyts
2964e72b00
Update src/future/timeout.rs
Co-Authored-By: Stjepan Glavina <stjepang@gmail.com>
2019-09-18 12:43:34 +02:00
Yoshua Wuyts
6b76fb1308
Update src/future/timeout.rs
Co-Authored-By: Stjepan Glavina <stjepang@gmail.com>
2019-09-18 12:43:27 +02:00
Yoshua Wuyts
9a07196402
Update src/stream/double_ended_stream.rs
Co-Authored-By: Stjepan Glavina <stjepang@gmail.com>
2019-09-18 12:43:14 +02:00
Yoshua Wuyts
f7ec3f4e2d
Update src/stream/stream/mod.rs
Co-Authored-By: Stjepan Glavina <stjepang@gmail.com>
2019-09-18 12:43:06 +02:00
Yoshua Wuyts
bfb16790c3
Update src/stream/from_stream.rs
Co-Authored-By: Stjepan Glavina <stjepang@gmail.com>
2019-09-18 12:42:58 +02:00
Yoshua Wuyts
b670600555
Update src/stream/into_stream.rs
Co-Authored-By: Stjepan Glavina <stjepang@gmail.com>
2019-09-18 12:42:46 +02:00
bors[bot]
ff20534384
Merge #167
167: add io::cursor r=stjepang a=yoshuawuyts

Adds `io::Cursor` and makes it so `io::prelude::*` behaves the way it does in std (so it can actually be implemented - though this might just have been a bug on my side??).

Ref #131. Thanks!

Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-18 10:07:41 +00:00
Yoshua Wuyts
488c90c0c4
add feature guards for unstable features
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-18 01:26:04 +02:00
bors[bot]
c8475ca95e
Merge #207
207: Added the ability to collect a stream of results r=yoshuawuyts a=sunjay

As requested here: https://twitter.com/yoshuawuyts/status/1174026374316773377

The standard library has a very useful implementation of `FromIterator` that takes an iterator of `Result<T, E>` values and is able to produce a value of type `Result<Vec<T>, E>`. I asked for this in `async-std` and @yoshuawuyts recommended that I contribute the impl. It turns out that the implementation in the standard library is even more general than I initially thought. It allows any collection that implements `FromIterator` to be collected from an iterator of `Result<T, E>` values. That means that you can collect into `Result<Vec<T>, E>`, `Result<HashSet<T>, E>`, etc.

I wanted to add a similarly generic impl for this crate so we can also support collecting into any collection that implements `FromStream`. 

The implementation for this is based heavily on [what exists in `std`](9150f844e2/src/libcore/result.rs (L1379-L1429)). I made a new `result` module since that's where this impl is in `std`. I still wanted to maintain the conventions of this repo, so I copied the `vec` module that @yoshuawuyts created in #125. Much like in that PR, the new `result` module is private.

There is a doctest in the documentation for `collect` that both teaches that this feature exists and tests that it works in some simple cases.

## Documentation Screenshot

![image](https://user-images.githubusercontent.com/530939/65075935-de89ae00-d965-11e9-9cd6-8b19b694ed3e.png)


Co-authored-by: Sunjay Varma <varma.sunjay@gmail.com>
2019-09-17 22:35:00 +00:00
bors[bot]
4f9e7d39e2
Merge #40
40: Add initial Fuse implementation for Stream r=yoshuawuyts a=spacejam

@matklad does this address your use case?

Co-authored-by: Tyler Neely <tyler.neely@ferrous-systems.com>
Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-17 22:08:18 +00:00
Yoshua Wuyts
aa94d450d6
update stream::fuse
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-18 00:00:30 +02:00
Tyler Neely
7b4bb26c5c
Remove redundant Sized bound
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-17 23:52:26 +02:00
Tyler Neely
44b3d3dadd
Remove irrelevant example
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-17 23:50:22 +02:00
Tyler Neely
78c49f92b6
Add initial Fuse implementation for Stream
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-17 23:48:14 +02:00
Yoshua Wuyts
d0312a028c
mark task::ready as unstable
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-17 23:32:38 +02:00
Yoshua Wuyts
d5725e78be
use async-macros
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-17 23:24:15 +02:00
Yoshua Wuyts
1ad339a19e
rebase on master
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-17 23:22:30 +02:00
Yoshua Wuyts
4b535d4ada
expose future::ready!
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-17 23:22:30 +02:00
bors[bot]
af6ed7d0ee
Merge #205
205: Implement simple work stealing r=yoshuawuyts a=stjepang

This is our first version of a work-stealing scheduler. We won't stop here, there is still lots of room for improvement.

Co-authored-by: Stjepan Glavina <stjepang@gmail.com>
2019-09-17 21:20:44 +00:00
Sunjay Varma
c87dab2d5e rustfmt 2019-09-17 16:48:58 -04:00
Yoshua Wuyts
fb2d2e28c1
try_select, select
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-17 22:35:47 +02:00
Yoshua Wuyts
4cbc31938d
add future::{join,try_join} macros
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-17 22:35:47 +02:00
Sunjay Varma
ad0510110c Added the ability to collect a stream of results 2019-09-17 16:25:26 -04:00
Yoshua Wuyts
98927a79a9
rebase
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-17 19:17:51 +02:00
Yoshua Wuyts
e6a3160c8b
add unstable cfg to FromStream/IntoStream
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-17 19:17:51 +02:00
Yoshua Wuyts
cb7f3dd376
remove unused types
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-17 19:17:51 +02:00
Yoshua Wuyts
6ee3f6cf9c
tests pass again
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-17 19:17:51 +02:00
Yoshua Wuyts
6c4c958abc
from/into stream
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

update examples

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

impl collect

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

compiles!

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

layout base for collect into vec

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

fmt

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

progress

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

compiles!

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

define failing test

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

cargo fmt

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

stuck again

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

fix trait bounds!

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

cargo fmt

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

hide dyn fut impl

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

dyn ret for vec

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

cargo fmt

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

collect docs

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

remove macro from vec::from_stream

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

shorten collect trait bound

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

Remove some Unpin and Send bounds

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-17 19:17:49 +02:00
Stjepan Glavina
04dbcbb639
Update src/task/worker.rs
Co-Authored-By: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-17 12:28:19 +01:00
bors[bot]
60a62f90fd
Merge #180
180: adds stream::fold combinator r=stjepang a=montekki

Fold. Kind of clumsy around the part with the option and moving out of the shared context.
___
Stdlib: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.fold
Ref: #129 

Co-authored-by: Fedor Sakharov <fedor.sakharov@gmail.com>
2019-09-17 09:56:18 +00:00
bors[bot]
08d954bb91
Merge #178
178: adds stream::enumerate combinator r=stjepang a=montekki

enumerate might be handy.
---
Stdlib: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.enumerate
Ref: #129 

Co-authored-by: Fedor Sakharov <fedor.sakharov@gmail.com>
2019-09-17 09:38:31 +00:00
Fedor Sakharov
9487b73f12
Update src/stream/stream/enumerate.rs
Co-Authored-By: Stjepan Glavina <stjepang@gmail.com>
2019-09-17 12:31:24 +03:00
Fedor Sakharov
efe351659f
Fixes review issues 2019-09-17 12:25:02 +03:00
Stjepan Glavina
0924911ac3 Implement simple work stealing 2019-09-17 11:12:47 +02:00
bors[bot]
d73e54450c
Merge #203
203: expose std::pin r=yoshuawuyts a=yoshuawuyts

This is important when defining / calling futures, so it makes sense for us to also export this.

But also given recent user feedback on the confusion on pinning, I'd like to open up the possibility to experiment with providing better pinning facilities  such as [`pin-project`](https://github.com/taiki-e/pin-project) or [`pin_mut`](https://docs.rs/pin-utils/0.1.0-alpha.4/pin_utils/macro.pin_mut.html) behind flags. I'm not sure if we could, or even should. But I want to allow us to have that conversation and test things out (even if it's just in floating patches.)

Thanks!

Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-17 09:01:53 +00:00
bors[bot]
265f1ff8eb
Merge #204
204: Add Stream::zip r=stjepang a=tirr-c



Co-authored-by: Wonwoo Choi <chwo9843@gmail.com>
2019-09-17 08:49:33 +00:00
Wonwoo Choi
73db46c90d Add Stream::zip 2019-09-17 14:11:06 +09:00
Yoshua Wuyts
39a1c2b577
add link to std pin docs
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-16 22:34:11 +02:00
Yoshua Wuyts
cafcddb0e1
feature guard pin
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-16 20:17:27 +02:00
Yoshua Wuyts
e9de779863
unstable facade around the pin submodule
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-16 19:59:56 +02:00
Yoshua Wuyts
7c73cdff25
cargo fmt
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-16 19:59:56 +02:00
Yoshua Wuyts
343a6c1039
expose std::pin
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-16 19:59:56 +02:00
bors[bot]
ee31f68e80
Merge #190 #200
190: Clean up the fs module and a few other places r=stjepang a=stjepang

Just a cleanup for various pieces of documentation, mainly around the `lib.rs` docs, the prelude, and the `fs` module. Some small bugs are also fixed along the way.

This PR is the first one in a series of review PRs that I will be submitting before the upcoming 1.0 release.

200: expose IoSlice, IoSliceMut r=stjepang a=yoshuawuyts

Exposes `io::IoSlice` and `io::IoSliceMut`. Given we're returning these from `read_vectored` and `write_vectored` it might make sense to just include them as part of our re-exports. Thanks!

Ref #131.

Co-authored-by: Stjepan Glavina <stjepang@gmail.com>
Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-16 13:51:12 +00:00
Yoshua Wuyts
1341fa7add
cargo fmt
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-16 15:34:06 +02:00
Yoshua Wuyts
ab112e9f39
expose IoSlice, IoSliceMut
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-16 14:22:52 +02:00
Yoshua Wuyts
9c82d5e3f3
remove custom log tools in favor of macro crate
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-16 14:07:06 +02:00
Wonwoo Choi
b70dfeab15 Require S: async_std::stream::Stream in Scan 2019-09-16 18:35:37 +09:00
Wonwoo Choi
d6ffdbce8d Remove Unpin bound in impl Stream for T 2019-09-16 18:25:46 +09:00
Wonwoo Choi
689b3c6560 Add io::repeat 2019-09-16 16:47:17 +09:00
bors[bot]
03f5022262
Merge #195
195: Remove the Send bound from block_on r=stjepang a=stjepang



Co-authored-by: Stjepan Glavina <stjepang@gmail.com>
2019-09-16 07:31:21 +00:00
bors[bot]
f4182caa4a
Merge #196
196: Remove more Unpin bounds for Stream::scan r=stjepang a=tirr-c

cc #192. I missed the bounds on `Stream::scan` itself.

Co-authored-by: Wonwoo Choi <chwo9843@gmail.com>
2019-09-16 06:50:43 +00:00
bors[bot]
c6fecbd4ef
Merge #171
171: Add BufRead::consume r=stjepang a=yoshuawuyts

Ref #131. This implements `BufReader::consume`. Thanks!


Note on `fill_buf`: I couldn't get the `async fn fill_buf()` to work, but tracked progress for it here: https://gist.github.com/yoshuawuyts/09bbdc7823225ca96b5e35cd1da5d581. Got some lifetimes isssues. If anyone wants to give this a shot, please do!

Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-16 06:38:44 +00:00
Wonwoo Choi
e7b0fe2d2e Remove Unpin bounds more 2019-09-16 11:30:09 +09:00
bors[bot]
5f7a4433d5
Merge #192
192: Add Stream::scan r=stjepang a=tirr-c

Ref #129. The mapper function `f` is synchronous and returns bare `Option<B>`.

Asynchronous `f` seems tricky to implement right. It requires the wrapper to be self-referential, as a reference to internal state may be captured by the returned future.

Co-authored-by: Wonwoo Choi <chwo9843@gmail.com>
2019-09-15 21:38:37 +00:00
Wonwoo Choi
91e61cf6bf Remove unnecessary Unpin bounds 2019-09-15 21:18:02 +09:00
Stjepan Glavina
1d862cf604 Remove the Send bound from block_on 2019-09-15 00:36:17 +02:00
Kevin Donahue
127feb47f9 add doc comment for join handle drop behavior 2019-09-14 16:35:27 -04:00
Wonwoo Choi
50a7db2af4 Add Stream::scan 2019-09-14 23:26:46 +09:00
Stjepan Glavina
7f71af9415 cargo fmt 2019-09-14 09:15:51 +02:00
Stjepan Glavina
a4381230b8 Clean up the fs module and a few other places 2019-09-14 01:24:31 +02:00
Yoshua Wuyts
3b8e604acc
mark io::cursor as unstable
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-13 20:02:31 +02:00
Yoshua Wuyts
69c9162558
fix tests
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-13 19:58:18 +02:00
Yoshua Wuyts
a5b0acb378
AsyncBufRead for Cursor
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-13 19:58:18 +02:00
Yoshua Wuyts
0bc39e6e6c
add io::cursor
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-13 19:58:18 +02:00
bors[bot]
e060326910
Merge #177
177: implement DoubleEndedStream r=yoshuawuyts a=yoshuawuyts

Ref #129. This is the most basic version of the `DoubleEndedStream` trait. Because there is no counterpart in `futures-rs` we allow this to be implementable (not sure if we should though?).

This is not a high-priority trait to implement, with probably the most useful addition being the blanket impl over [`std::iter::Fuse`](https://doc.rust-lang.org/std/iter/struct.Fuse.html) (where we should have a `Fuse` counterpart for `Stream` also).

So I'm taking this one step at the time, and this PR introduces just the bare minimum to get things working. Thanks!

r? @stjepang @taiki-e

## Refs
- https://doc.rust-lang.org/std/iter/trait.DoubleEndedIterator.html
- #129 


Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-13 17:52:10 +00:00
Yoshua Wuyts
fda74ac0ab
mark as unstable
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-13 19:36:57 +02:00
Yoshua Wuyts
40fb485cca
cargo fmt
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-13 19:35:18 +02:00
Yoshua Wuyts
23ca060e4c
implement DoubleEndedStream
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-13 19:35:18 +02:00
bors[bot]
3054509fd0
Merge #184
184: housekeeping after 145 r=yoshuawuyts a=montekki

Now that #145 is merged combinators can follow.
1. All combinators taking `&mut self` should imply `Self: Pin`.
2. Trait bounds are to `Stream`
3. Cleans up docs and `Debug` derives.

Co-authored-by: Fedor Sakharov <fedor.sakharov@gmail.com>
2019-09-13 17:31:48 +00:00
Yoshua Wuyts
d68d6bb052
links the timeout docs to each other
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-13 17:58:03 +02:00
Yoshua Wuyts
10fedfe97f
implement feedback for bufreader methods
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-13 02:21:36 +02:00
Yoshua Wuyts
ab0a4cb966
remove pin<self> bounds from consume
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-13 02:16:47 +02:00
Stjepan Glavina
2818c7099f Suppress a lint that makes CI fail on windows 2019-09-12 23:24:20 +02:00
Stjepan Glavina
5429c2c0a3 cargo fmt 2019-09-12 18:49:09 +02:00
Stjepan Glavina
d25dae5419 Refactor the networking driver 2019-09-12 18:45:53 +02:00
Fedor Sakharov
0080a0da8c
change expect to unwrap 2019-09-12 18:15:20 +03:00
Fedor Sakharov
6c3f8af62d
fixes after #145 2019-09-11 22:07:20 +03:00
Fedor Sakharov
774550ca99
Merge branch 'master' into fs-stream-fold 2019-09-11 22:05:04 +03:00
Fedor Sakharov
3dc33f54b4
fixes after #145 2019-09-11 22:03:44 +03:00
Fedor Sakharov
9b3658244d
Merge branch 'master' into fs-stream-enumerate 2019-09-11 22:01:48 +03:00
Fedor Sakharov
18428d6bfe
housekeeping after 145 2019-09-11 21:47:52 +03:00
Stjepan Glavina
2497f4d3e1 Merge branch 'master' into poll_next 2019-09-11 17:08:25 +02:00
Stjepan Glavina
724a9f4eb0 Add Stream::poll_next 2019-09-11 17:06:02 +02:00
Wonwoo Choi
06f2569d23 Add BufRead::fill_buf (#176)
* Add BufRead::fill_buf

* Make FillBufFuture constructor pub(crate)

* Give more information about the transmutation source type
2019-09-11 16:02:57 +01:00
Fedor Sakharov
cdd4215e8f
forgot None case 2019-09-11 10:09:52 +03:00
Fedor Sakharov
2d75ffacc4
fixes example to resemble std more 2019-09-11 10:08:08 +03:00
Fedor Sakharov
5b720ab1e2
adds stream::fold combinator 2019-09-11 09:54:25 +03:00
Fedor Sakharov
97a5f9b50c
adds stream::find combinator 2019-09-10 23:38:11 +03:00
Fedor Sakharov
ed944d051a
adds stream::enumerate combinator 2019-09-10 20:43:56 +03:00
Fedor Sakharov
efb8415429
Merge branch 'master' into fs-stream-find-map 2019-09-10 16:25:38 +03:00
bors[bot]
6d1e71fb68
Merge #163
163: adds stream::filter_map combinator r=yoshuawuyts a=montekki

Implements a `flat_map` combinator. Currently the same about `ret!` as in #162 .

Also the naming should probably be `FilterMapStream`, but in that case `Take` stream should also change it's name i guess.

Stdlib: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.flat_map
Ref: #129 

Co-authored-by: Fedor Sakharov <fedor.sakharov@gmail.com>
2019-09-10 12:41:08 +00:00
bors[bot]
a0c9442261
Merge #166
166: adds stream::nth combinator r=yoshuawuyts a=montekki

Implements `nth` combinator.

---
Stdlib: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.nth
Ref: #129 

Co-authored-by: Fedor Sakharov <fedor.sakharov@gmail.com>
2019-09-10 12:11:04 +00:00
Fedor Sakharov
9b381e427f
Apply suggestions from code review
Co-Authored-By: Yoshua Wuyts <yoshuawuyts+github@gmail.com>
2019-09-10 15:01:25 +03:00
Fedor Sakharov
272f74c1da fixes to stream::min_by (#162)
* fixes to stream::min_by

* no reason to split these impls

* remove Debug derive from MinByFuture
2019-09-10 13:53:30 +02:00
Fedor Sakharov
45bd0ef13d
adds stream::find_map combinator 2019-09-10 09:59:00 +03:00
James Munns
6db71e597b Add link to silence doc warning 2019-09-10 03:50:03 +02:00
Fedor Sakharov
43b7523c69
remove Debug derive from NthFuture 2019-09-09 12:42:52 +03:00
Stjepan Glavina
2c02037673 Fix a typo 2019-09-09 09:18:56 +02:00
bors[bot]
b849669998
Merge #165
165: Fix a bug in conversion of File into raw handle r=stjepang a=stjepang

Same bugfix as #148, but applied to `async_std::fs::File`.

Co-authored-by: Stjepan Glavina <stjepang@gmail.com>
2019-09-08 22:34:38 +00:00
bors[bot]
7c05356ef4
Merge #148
148: Make sure into_raw_fd doesn't close the file descriptor r=stjepang a=yshui

Closes #147 

Co-authored-by: Yuxuan Shui <yshuiv7@gmail.com>
Co-authored-by: yshui <yshuiv7@gmail.com>
2019-09-08 22:19:29 +00:00
yshui
8e2bf24456
Apply suggestions from code review
Co-Authored-By: Stjepan Glavina <stjepang@gmail.com>
2019-09-08 23:16:34 +01:00
Fedor Sakharov
45cd3b0894
adds stream::nth combinator 2019-09-08 21:42:35 +03:00
Stjepan Glavina
41f345d319 Fix a bug in conversion of File into raw handle 2019-09-08 19:19:34 +02:00
Yoshua Wuyts
9bf06ce52b fix io::copy link (#164)
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-08 17:41:23 +02:00
Fedor Sakharov
55bdea4649
adds stream::filter_map combinator 2019-09-08 18:09:33 +03:00
bors[bot]
63f3a809aa
Merge #161
161: Split BufRead into multiple files r=stjepang a=stjepang



Co-authored-by: Stjepan Glavina <stjepang@gmail.com>
2019-09-08 14:27:43 +00:00
Yoshua Wuyts
ba43a05d01 split stream into multiple files (#150)
* split stream into multiple files

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>

* cargo fmt

Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-08 12:56:51 +02:00
Stjepan Glavina
55550c6fc9 Split BufRead into multiple files 2019-09-08 12:54:22 +02:00
Stjepan Glavina
8c00cc53ce Flush more often to prevent flushes during seek 2019-09-08 12:14:07 +02:00
bors[bot]
8d3d80a678
Merge #151
151: Split io into multiple files r=stjepang a=yoshuawuyts

Counterpart to #150, splits `io::read` and `io::write` into multiple files. This is useful to prevent a single file from becoming hard to navigate as we add more combinators. No other changes were made. Ref #131. Thanks!

Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-08 09:57:36 +00:00
bors[bot]
a8a2ae9e29
Merge #157
157: More robust file implementation r=stjepang a=stjepang

This is a reimplementation of the `File`s state machine.

The previous implementation was simple and a bit naive. It was not fundamentally wrong but had surprises in some corner cases. For example, if an async read operation was started but we timed out on it, the file cursor would move even though we didn't complete the operation. The new implementation will move the cursor only when read/write operations complete successfully.

There was also a deadlock hazard in the case where multiple tasks were concurrently reading or writing to the same file, in which case some task wakeups would be lost. This PR fixes the problem.

A nice consequence of this PR: `futures-channel` is now unused, so we can remove it from the dependency list.

Co-authored-by: Stjepan Glavina <stjepang@gmail.com>
2019-09-08 08:44:17 +00:00
Stjepan Glavina
6ed0e857fd Fix some typos, expand comments 2019-09-08 10:43:47 +02:00
Yoshua Wuyts
ec1f33fe62
inline better
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-08 02:03:09 +02:00
Yoshua Wuyts
b1d85ab460
add io::prelude
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-08 01:55:39 +02:00
Stjepan Glavina
17c95a39d7
More robust file implementation
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-07 23:17:20 +02:00
Yoshua Wuyts
910801e2d6
fix doc compile
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-07 23:15:21 +02:00
Yoshua Wuyts
e1137345d4
cargo fmt
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-07 23:15:21 +02:00
Yoshua Wuyts
4a2194f37c
split io::write into multiple files
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-07 23:15:21 +02:00
Yoshua Wuyts
a90100962d
split io::read into multiple files
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-07 23:15:21 +02:00
Fedor Sakharov
91a66c2d94
append doc example for io::buf_read::read_until 2019-09-06 21:58:53 +03:00