Commit Graph

292 Commits (a4381230b877992557f3e50a241d914a201284c4)
 

Author SHA1 Message Date
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
bors[bot] cc9e078d1b
Merge #160
160: add io::prelude r=stjepang a=yoshuawuyts

I was working on some async io code earlier, and ended up writing:
```rust
    use async_std::io::{BufReader, BufRead, Read};
```

It took a bit of trial and error to get the right traits in scope, and I kind of wished I had `io::prelude` available so it would *just work*. Which is why this patch adds `io::prelude`. I guess I'm kind of circling back on the idea of only having a single prelude; but overall I think this feels more intuitive. Thanks!

## Screenshots
![Screenshot_2019-09-08 async_std io - Rust](https://user-images.githubusercontent.com/2467194/64481454-8e2f8500-d1dc-11e9-9299-7a82b7dbb031.png)
![Screenshot_2019-09-08 async_std io prelude - Rust](https://user-images.githubusercontent.com/2467194/64481455-8e2f8500-d1dc-11e9-9d20-1e90fabccaf4.png)
![Screenshot_2019-09-08 std io prelude - Rust](https://user-images.githubusercontent.com/2467194/64481509-bfa85080-d1dc-11e9-9965-be7d0d84b551.png)



Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
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
Yoshua Wuyts 98d9284e64
disable mdbook to allow tests to pass again (#159)
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
5 years ago
Florian Gilcher f27f927d1d
Merge pull request #156 from montekki/fs-fix-153
append doc example for io::buf_read::read_until
5 years ago
Fedor Sakharov 91a66c2d94
append doc example for io::buf_read::read_until 5 years ago
Atul Bhosale 5d73776c69 Use the latest toolchain with rustfmt available if rustfmt is unavailable on the latest nightly (#155) 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
Yuxuan Shui 2ca9c46b4b
Add tests for UnixDatagram from_raw_fd/into_raw_fd 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
Aleksey Kladov 75a4ba80cc
Merge pull request #144 from matklad/move-a-chat
move a-chat tutorial's code to this repo
5 years ago
Aleksey Kladov 5b96fa9daa move a-chat tutorial's code to this repo 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
Stjepan Glavina 1f7f318c36 Add bors.toml 5 years ago
Roman Proskuryakov dde4b89369 Make Travis cfg pretty and modular (#118) 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
Yuki Okushi 532c73cf77 Fix typo in stability-guarantees.md (#136) 5 years ago
James Munns e99eafe64f
Merge pull request #132 from shekohex/stream-all-method
Stream::all implementation
5 years ago
Jason Davies a4d2cd1c82 Fix typo. (#134) 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
James Munns c6e4c659c4 Restore Version Sort (#121)
Since we only build the book on Linux for now, restore the `--version-sort` flag for gnu sort. This makes me feel better that when sorting numbering oddities (e.g. multiple digits) will be handled correctly.

This was removed when I was trying to get this script to work on Windows and OSX, which is no longer relevant.
5 years ago
Florian Gilcher d89b384620
Merge pull request #116 from async-rs/install-mdbook-bin
Implement installation using trust
5 years ago
James Munns 192c9683d9 Correct boolean inversion and overrided env vars 5 years ago
James Munns b39c720681 Only install mdbook if building the book 5 years ago
James Munns b6c8186846 Don't use version sort (bsd sort doesn't seem to have it) 5 years ago
James Munns e0212e5229 Don't install cargo-update at all 5 years ago
James Munns f5823df70c Include modified trust file 5 years ago
James Munns eba85c3ede Fix regex, also install cargo-update with trust 5 years ago
James Munns de62620460 Implement installation using trust 5 years ago
Roman Proskuryakov 8dff8951a6 Reduce io::TimeoutFuture to futures_timer::TryFutureExt (#113) 5 years ago
Florian Gilcher d501bf6849
Merge pull request #112 from async-rs/fix-101
Import HashMap visibly in the tutorial
5 years ago
Florian Gilcher 366546b9ce
Visibly import in tasks example
Fixes #97
5 years ago