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

397 commits

Author SHA1 Message Date
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
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
Oleksii Kachaiev
55ea367415 Rename server functions to follow *_loop convention (#139)
Rename: server -> accept_loop, client -> connection_loop, client_writer -> connection_writer_loop
2019-09-20 09:54:48 +03:00
bors[bot]
4aceee1b61
Merge #218
218: expose sync::{Arc,Weak} r=stjepang a=yoshuawuyts

Ref #217. Exposes `std::sync::Arc` and `std::sync::Weak`. Thanks!

Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-19 17:31:22 +00:00
Yoshua Wuyts
fa31c6347e
expose sync::{Arc,Weak}
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-19 18:28:17 +02:00
bors[bot]
8be7655672
Merge #216
216: fix unstable display for pin docs r=yoshuawuyts a=yoshuawuyts

On https://docs.rs/async-std/0.99.6/async_std/ `pin` is not properly showing up as "unstable" despite being guarded as such. This fixes that. Thanks!

Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-19 16:04:08 +00: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
bors[bot]
47194353c8
Merge #215
215: prepare v0.99.6 r=yoshuawuyts a=yoshuawuyts

Prepares us for the next release. Thanks!

Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-19 12:47:58 +00:00
Yoshua Wuyts
8d31aa69cf
prepare v0.99.6
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-19 14:24:58 +02:00
bors[bot]
f45b39d7c0
Merge #208
208: add stream::join r=stjepang a=yoshuawuyts

Ref #129 #187. This adds the `stream::join` which can join multiple streams into a single stream. Thanks!

## Example
```rust
let a = stream::once(1u8);
let b = stream::once(2u8);
let c = stream::once(3u8);

let mut s = stream::join!(a, b, c);

assert_eq!(s.collect().await, vec![1u8, 2u8, 3u8]);
```

## Screenshot

![Screenshot_2019-09-17 async_std stream - Rust](https://user-images.githubusercontent.com/2467194/65080099-cedb8b00-d9a0-11e9-984f-edd7d6bad5cc.png)


Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-19 11:59:10 +00:00
Yoshua Wuyts
7fe6c8a42c
add stream::join
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-19 13:53:36 +02: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
bd43490d72
fix cargo test --doc
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-18 22:56:13 +02: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
Stjepan Glavina
4b32749886
Update README.md 2019-09-18 13:57:26 +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
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
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
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