Commit Graph

909 Commits (mio-0-7)

Author SHA1 Message Date
Fedor Sakharov e74c0cec1f
adds stream::step_by combinator 5 years ago
Fedor Sakharov ea080e7305
Merge branch 'master' into fs-stream-skip-while 5 years ago
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>
5 years ago
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>
5 years ago
Fedor Sakharov fdd81e1b2a
Actually export Skip 5 years ago
Fedor Sakharov e430851bc4
export Filter type 5 years ago
Fedor Sakharov 75da138696
export Skip type 5 years ago
Fedor Sakharov 93463e8df3
export SkipWhile type 5 years ago
Stjepan Glavina 53ce30ae66
Fix async_std imports in metadata.rs 5 years ago
Stjepan Glavina 1fa196812a Fix compilation errors around Stream 5 years ago
Stjepan Glavina edfa2358a4 Re-export IO traits from futures 5 years ago
Fedor Sakharov f9f97c43c4
adds stream::skip_while combinator 5 years ago
Fedor Sakharov 570329b176
adds stream::skip combinator 5 years ago
Fedor Sakharov e7ae10ebee
adds stream::filter combinator 5 years ago
Yoshua Wuyts fa31c6347e
expose sync::{Arc,Weak}
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts 42fac26761
fix unstable display for pin docs
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts 7fe6c8a42c
add stream::join
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Wonwoo Choi 9c00d0b903 Rename: extend_with_stream => stream_extend 5 years ago
Wonwoo Choi a5a6dc24c4 Add stream::Extend 5 years ago
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>
5 years ago
Yoshua Wuyts c533d5f906
implement feedback & fix tests
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Stjepan Glavina bfd7af8775 Rename local.rs -> task_local.rs 5 years ago
Yoshua Wuyts 2964e72b00
Update src/future/timeout.rs
Co-Authored-By: Stjepan Glavina <stjepang@gmail.com>
5 years ago
Yoshua Wuyts 6b76fb1308
Update src/future/timeout.rs
Co-Authored-By: Stjepan Glavina <stjepang@gmail.com>
5 years ago
Yoshua Wuyts 9a07196402
Update src/stream/double_ended_stream.rs
Co-Authored-By: Stjepan Glavina <stjepang@gmail.com>
5 years ago
Yoshua Wuyts f7ec3f4e2d
Update src/stream/stream/mod.rs
Co-Authored-By: Stjepan Glavina <stjepang@gmail.com>
5 years ago
Yoshua Wuyts bfb16790c3
Update src/stream/from_stream.rs
Co-Authored-By: Stjepan Glavina <stjepang@gmail.com>
5 years ago
Yoshua Wuyts b670600555
Update src/stream/into_stream.rs
Co-Authored-By: Stjepan Glavina <stjepang@gmail.com>
5 years ago
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>
5 years ago
Yoshua Wuyts 488c90c0c4
add feature guards for unstable features
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
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>
5 years ago
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>
5 years ago
Yoshua Wuyts aa94d450d6
update stream::fuse
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Tyler Neely 7b4bb26c5c
Remove redundant Sized bound
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Tyler Neely 44b3d3dadd
Remove irrelevant example
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Tyler Neely 78c49f92b6
Add initial Fuse implementation for Stream
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts d0312a028c
mark task::ready as unstable
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts d5725e78be
use async-macros
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts 1ad339a19e
rebase on master
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts 4b535d4ada
expose future::ready!
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
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>
5 years ago
Sunjay Varma c87dab2d5e rustfmt 5 years ago
Yoshua Wuyts fb2d2e28c1
try_select, select
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts 4cbc31938d
add future::{join,try_join} macros
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Sunjay Varma ad0510110c Added the ability to collect a stream of results 5 years ago
Yoshua Wuyts 98927a79a9
rebase
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts e6a3160c8b
add unstable cfg to FromStream/IntoStream
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts cb7f3dd376
remove unused types
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts 6ee3f6cf9c
tests pass again
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
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>
5 years ago
Stjepan Glavina 04dbcbb639
Update src/task/worker.rs
Co-Authored-By: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
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>
5 years ago
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>
5 years ago
Fedor Sakharov 9487b73f12
Update src/stream/stream/enumerate.rs
Co-Authored-By: Stjepan Glavina <stjepang@gmail.com>
5 years ago
Fedor Sakharov efe351659f
Fixes review issues 5 years ago
Stjepan Glavina 0924911ac3 Implement simple work stealing 5 years ago
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>
5 years ago
bors[bot] 265f1ff8eb
Merge #204
204: Add Stream::zip r=stjepang a=tirr-c



Co-authored-by: Wonwoo Choi <chwo9843@gmail.com>
5 years ago
Wonwoo Choi 73db46c90d Add Stream::zip 5 years ago
Yoshua Wuyts 39a1c2b577
add link to std pin docs
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts cafcddb0e1
feature guard pin
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts e9de779863
unstable facade around the pin submodule
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts 7c73cdff25
cargo fmt
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts 343a6c1039
expose std::pin
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
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>
5 years ago
Yoshua Wuyts 1341fa7add
cargo fmt
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts ab112e9f39
expose IoSlice, IoSliceMut
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts 9c82d5e3f3
remove custom log tools in favor of macro crate
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Wonwoo Choi b70dfeab15 Require S: async_std::stream::Stream in Scan 5 years ago
Wonwoo Choi d6ffdbce8d Remove Unpin bound in `impl Stream for T` 5 years ago
Wonwoo Choi 689b3c6560 Add io::repeat 5 years ago
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>
5 years ago
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>
5 years ago
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>
5 years ago
Wonwoo Choi e7b0fe2d2e Remove Unpin bounds more 5 years ago
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>
5 years ago
Wonwoo Choi 91e61cf6bf Remove unnecessary Unpin bounds 5 years ago
Stjepan Glavina 1d862cf604 Remove the Send bound from block_on 5 years ago
Kevin Donahue 127feb47f9 add doc comment for join handle drop behavior 5 years ago
Wonwoo Choi 50a7db2af4 Add Stream::scan 5 years ago
Stjepan Glavina 7f71af9415 cargo fmt 5 years ago
Stjepan Glavina a4381230b8 Clean up the fs module and a few other places 5 years ago
Yoshua Wuyts 3b8e604acc
mark io::cursor as unstable
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts 69c9162558
fix tests
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts a5b0acb378
AsyncBufRead for Cursor
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts 0bc39e6e6c
add io::cursor
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
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>
5 years ago
Yoshua Wuyts fda74ac0ab
mark as unstable
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts 40fb485cca
cargo fmt
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts 23ca060e4c
implement DoubleEndedStream
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
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>
5 years ago
Yoshua Wuyts d68d6bb052
links the timeout docs to each other
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts 10fedfe97f
implement feedback for bufreader methods
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts ab0a4cb966
remove pin<self> bounds from consume
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Stjepan Glavina 2818c7099f Suppress a lint that makes CI fail on windows 5 years ago
Stjepan Glavina 5429c2c0a3 cargo fmt 5 years ago
Stjepan Glavina d25dae5419 Refactor the networking driver 5 years ago
Fedor Sakharov 0080a0da8c
change expect to unwrap 5 years ago
Fedor Sakharov 6c3f8af62d
fixes after #145 5 years ago
Fedor Sakharov 774550ca99
Merge branch 'master' into fs-stream-fold 5 years ago
Fedor Sakharov 3dc33f54b4
fixes after #145 5 years ago
Fedor Sakharov 9b3658244d
Merge branch 'master' into fs-stream-enumerate 5 years ago
Fedor Sakharov 18428d6bfe
housekeeping after 145 5 years ago
Stjepan Glavina 2497f4d3e1 Merge branch 'master' into poll_next 5 years ago
Stjepan Glavina 724a9f4eb0 Add Stream::poll_next 5 years ago
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
5 years ago
Fedor Sakharov cdd4215e8f
forgot None case 5 years ago
Fedor Sakharov 2d75ffacc4
fixes example to resemble std more 5 years ago
Fedor Sakharov 5b720ab1e2
adds stream::fold combinator 5 years ago
Fedor Sakharov 97a5f9b50c
adds stream::find combinator 5 years ago
Fedor Sakharov ed944d051a
adds stream::enumerate combinator 5 years ago
Fedor Sakharov efb8415429
Merge branch 'master' into fs-stream-find-map 5 years ago
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>
5 years ago
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>
5 years ago
Fedor Sakharov 9b381e427f
Apply suggestions from code review
Co-Authored-By: Yoshua Wuyts <yoshuawuyts+github@gmail.com>
5 years ago
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
5 years ago
Fedor Sakharov 45bd0ef13d
adds stream::find_map combinator 5 years ago
James Munns 6db71e597b Add link to silence doc warning 5 years ago
Fedor Sakharov 43b7523c69
remove Debug derive from NthFuture 5 years ago
Stjepan Glavina 2c02037673 Fix a typo 5 years ago
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>
5 years ago
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>
5 years ago
yshui 8e2bf24456
Apply suggestions from code review
Co-Authored-By: Stjepan Glavina <stjepang@gmail.com>
5 years ago
Fedor Sakharov 45cd3b0894
adds stream::nth combinator 5 years ago
Stjepan Glavina 41f345d319 Fix a bug in conversion of File into raw handle 5 years ago
Yoshua Wuyts 9bf06ce52b fix io::copy link (#164)
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Fedor Sakharov 55bdea4649
adds stream::filter_map combinator 5 years ago
bors[bot] 63f3a809aa
Merge #161
161: Split BufRead into multiple files r=stjepang a=stjepang



Co-authored-by: Stjepan Glavina <stjepang@gmail.com>
5 years ago
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>
5 years ago
Stjepan Glavina 55550c6fc9 Split BufRead into multiple files 5 years ago
Stjepan Glavina 8c00cc53ce Flush more often to prevent flushes during seek 5 years ago
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>
5 years ago
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>
5 years ago
Stjepan Glavina 6ed0e857fd Fix some typos, expand comments 5 years ago
Yoshua Wuyts ec1f33fe62
inline better
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts b1d85ab460
add io::prelude
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Stjepan Glavina 17c95a39d7
More robust file implementation
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts 910801e2d6
fix doc compile
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts e1137345d4
cargo fmt
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts 4a2194f37c
split io::write into multiple files
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Yoshua Wuyts a90100962d
split io::read into multiple files
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Fedor Sakharov 91a66c2d94
append doc example for io::buf_read::read_until 5 years ago
Florian Gilcher 481002ee71
Merge pull request #152 from montekki/fs-fix-buf-read-docs
fixes docs for io::buf_read::read_until
5 years ago
Fedor Sakharov a2c2413bc5
fixes docs for io::buf_read::read_until 5 years ago
Fedor Sakharov 7e3599a6a5 add stream::min_by method (#146)
* add stream::min_by method

* Update src/stream/stream.rs

Co-Authored-By: Yoshua Wuyts <yoshuawuyts+github@gmail.com>
5 years ago
Yuxuan Shui 876059cfe0
Make sure ownership is transferred in into_raw_fd
Previously all of the into_raw_fd implementations only returns a copy of
the inner RawFd, while still holding the ownership of the file
descriptor when returning for into_raw_fd. Since `self` is dropped at
the end of into_raw_fd, the returned file descriptor will actually be
closed, render the function unuseable.

The patch makes sure that into_raw_fd actually takes the ownership of
the file descriptor all the way from the inner IoHandle. To achieve
this, I have to use an Option in IoHandle to store the I/O source. It's
not pretty, but I cannot come up with a better way.
5 years ago
Stjepan Glavina bac74c2d7f
Reduce dependency on futures crate (#140)
* Add future::poll_fn

* Replace all uses of poll_fn with the new one

* Remove some uses of futures

* Simplify ReadDir and DirEntry

* Remove some use of futures from File

* Use futures subcrates

* Fix imports in docs

* Remove futures-util dependency

* Remove futures-executor-preview

* Refactor

* Require more features in the futures-preview crate
5 years ago
DCjanus 238a3c882b Implement an async version of ToSocketAddrs (#74)
* Implement an async version of ToSocketAddrs

* fix documentation issue

* genius hack: pretending to be `impl Future`

* replace `std::net::ToSocketAddrs` with `async-std::net::ToSocketAddrs`

* Move unit tests into the tests directory

* Stylistic changes

* Remove re-exports in async_std::net

* fix broken link

* some mirror changes

* remove unnecessary format

* migrate: `std::net::ToSocketAddrs` -> `async_std::net::ToSocketAddrs`

* fix typo(tutorial)

* remove unnecessary type bound

* lifetime for future
5 years ago
Shady Khalifa bff10fe83b Stream::any implementation (#135)
* add stream::any method

* use `ret` macro and small improvements

* fix docs return type in `ret` macro
5 years ago
James Munns e99eafe64f
Merge pull request #132 from shekohex/stream-all-method
Stream::all implementation
5 years ago
Shady Khalifa e517c60fb1
remove comments 5 years ago
Shady Khalifa e8860454e7
remove extra newline
Co-Authored-By: Yoshua Wuyts <yoshuawuyts+github@gmail.com>
5 years ago
Stjepan Glavina 38a86766d3 Add future::timeout() (#20)
* Add future::timeout()

* Update src/future/timeout.rs

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

* Update src/future/timeout.rs

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

* Put futues::timeout behind unstable feature
5 years ago
Shady Khalifa 243a48c14e remove debug 5 years ago
Shady Khalifa fe45ba5628 update docs and examples 5 years ago
Shady Khalifa 3b80165532 add stream::all method 5 years ago
Roman Proskuryakov 374f0c9eb8 Refactor TcpStream::connect into resolving loop and TcpStream::connect_to (#119) 5 years ago
Roman Proskuryakov 8dff8951a6 Reduce io::TimeoutFuture to futures_timer::TryFutureExt (#113) 5 years ago
Dylan Frankland d47f7d3e92 rustfmt fs::create_dir_all 5 years ago
Dylan Frankland c21e381098 Remove unused import from fs::create_dir_all 5 years ago
Dylan Frankland 8451789da5 Expose fs::create_dir_all 5 years ago
Florian Gilcher 70769d8bac
Merge pull request #94 from async-rs/remove-async_await-gate
remove async_await feature gate
5 years ago
Yoshua Wuyts 63ad786768
remove async_await feature gate
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Kirill Mironov a0759a6c53 Implement LineWriter and BufWriter 5 years ago
Kirill Mironov 48d4c9b18d begin implementing BufWriter 5 years ago
Kirill Mironov 91aeb39e4c begin implementing BufWriter 5 years ago
Aleksey Kladov 04cafeab2c fix counting lines example 5 years ago
Andrew Chin 50e69dc765 Fix documention links to docs.rs 5 years ago
Stjepan Glavina 6418bc9849 Fix failing docs 5 years ago
Stjepan Glavina 0647de5e8d Tweak docs 5 years ago
Stjepan Glavina 3c42ecab8f Prepare for v0.99.0 5 years ago
Stjepan Glavina f4ff5443c8 Prepare for v0.99.0 5 years ago
Florian Gilcher 56cd64520d
Merge pull request #33 from async-rs/remove-time-module
Remove time module
5 years ago
Florian Gilcher fa407b18c0 Http with io timeouts (#42)
* Add simple http example with a timeout

* Update lib.rs simple http example comment

* Move to current io module
5 years ago
Florian Gilcher 9ae2742955
Fix book link 5 years ago
Stjepan Glavina 4b45918f50 Remove time module 5 years ago
Stjepan Glavina 8c647cf5b4
Merge pull request #32 from async-rs/tyler_randomized_spindown
Stagger background thread spin-down to avoid a thundering herd
5 years ago
Stjepan Glavina 487811ed4c
Merge pull request #19 from async-rs/io-timeout
Add io::timeout()
5 years ago
Tyler Neely 10146e31f0 Stagger background thread spin-down to avoid a thundering herd 5 years ago
Stjepan Glavina e3fc67c1cb Address comments 5 years ago
Florian Gilcher 228f22440c
Link to the book from lib.rs 5 years ago
Stjepan Glavina 9b3e8b8f26 Use our own Sink/Empty and fix compilation errors 5 years ago
Stjepan Glavina ea2da1f4a4
Merge branch 'master' into tyler_elastic_threadpool 5 years ago
Stjepan Glavina d512e7c45c Add io::timeout() 5 years ago
Stjepan Glavina 13835b0a78 Formatting 5 years ago
Stjepan Glavina dd40887750 Formatting 5 years ago
Stjepan Glavina e459bd048e Cleanup and docs 5 years ago
Stjepan Glavina 019c8085f4 Cleanup examples 5 years ago
Stjepan Glavina a2e54fcd29 Replace crossbeam with crossbeam-channel 5 years ago
Stjepan Glavina ae84fd4498
Merge branch 'master' into tyler_elastic_threadpool 5 years ago
Stjepan Glavina 1f9628d8ad Cleanup 5 years ago
Stjepan Glavina 01aac21386 Modularize time module 5 years ago
Stjepan Glavina 9d8ac36813 Rename feature docs.rs to docs 5 years ago
Stjepan Glavina 756da0e89d Modularize 5 years ago
Stjepan Glavina c3eee6cba5 Fix broken docs 5 years ago
Stjepan Glavina 68d7a9c34e Refactor 5 years ago
Stjepan Glavina a430e27819 Cleanup, docs, fmt 5 years ago
Stjepan Glavina 0ab2c8f49b typos 5 years ago
Stjepan Glavina e44451a042 Revamp IO traits and Stream trait 5 years ago
Stjepan Glavina 43d822cbc5 Add a html logo 5 years ago
Tyler Neely 445b4161cb Improve comment on the blocking threadpool 5 years ago
Aleksey Kladov 3ce68814b6 implement FusedStream for net::Incoming 5 years ago
Tyler Neely 81fa1d419a Remove all of the dynamic control stuff for now and just use nonblocking sends + 1 second receive timeouts 5 years ago
Tyler Neely ab613a53e5 Improve comments in the blocking threadpool 5 years ago
Tyler Neely 4cb1faf299 Use unbuffered work queue in the dynamic threadpool to reduce bufferbloat 5 years ago
Tyler Neely d75aae23cb Tune timings of dynamic threadpool 5 years ago
Stjepan Glavina 3f4a56abdc Reformat doc examples 5 years ago
Tyler Neely e97dfdc4cc Add dynamic threadpool 5 years ago
Florian Gilcher 5b0a6269a9
Initial commit 5 years ago