2
0
Fork 1
mirror of https://github.com/async-rs/async-std.git synced 2025-01-16 18:59:55 +00:00
Commit graph

526 commits

Author SHA1 Message Date
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
713ab026c3
build unstable for docs
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-18 03:47:47 +02: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
Yoshua Wuyts
b951cf2d3b
use async-macros 1.0.0
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-17 23:07:25 +02: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
bors[bot]
e6880e12e8
Merge #125
125: from/into stream r=yoshuawuyts a=yoshuawuyts

This adds `Stream` counterparts to `FromIterator`, `IntoIterator` and `Iterator::collect`, allowing to use the same patterns that are common in streams. Thanks!

## Tasks
- [x]  `FromStream`
- [x] `IntoStream`
- [x] `Stream::collect`

## Screenshot
![Screenshot_2019-08-29 async_std stream - Rust](https://user-images.githubusercontent.com/2467194/63928985-ec2bd200-ca50-11e9-868c-9899800e5b83.png)

Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-17 17:19:07 +00: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]
dd92d8dc61
Merge #202
202: Document feature flags in readme r=yoshuawuyts a=yoshuawuyts

Follow up to #190, this documents our feature flags in our readme. Thanks!

Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
Co-authored-by: Yoshua Wuyts <yoshuawuyts+github@gmail.com>
2019-09-16 14:08:50 +00:00
Yoshua Wuyts
8058d637e7
Update README.md
Co-Authored-By: Stjepan Glavina <stjepang@gmail.com>
2019-09-16 15:59:48 +02:00
Yoshua Wuyts
7827410c63
Update README.md 2019-09-16 15:59:41 +02:00
Yoshua Wuyts
e6fe8da058
Update README.md
Co-Authored-By: Stjepan Glavina <stjepang@gmail.com>
2019-09-16 15:58:37 +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
bors[bot]
36c437bc09
Merge #199
199: remove custom log code in favor of macro crate r=yoshuawuyts a=yoshuawuyts

This removes our custom log macro code in favor of using [`kv-log-macro`](https://github.com/yoshuawuyts/kv-log-macro). This is a temporary crate that exists only until https://github.com/rust-lang-nursery/log/pull/353 lands which enables progress on https://github.com/rust-lang-nursery/log/issues/328. Thanks!

Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-16 13:33:26 +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
6e5f29fa58
document feature flags
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-16 14:54:19 +02:00
Yoshua Wuyts
dc664786c9
document feature flags
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-16 14:46:56 +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