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

461 commits

Author SHA1 Message Date
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
714e173948 Cache cargo artifacts 2019-09-09 09:26:00 +02: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
Yoshua Wuyts
be71ac9d76 update deps (#149)
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-08 12:56:25 +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
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>
2019-09-08 08:18:08 +00: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
Yoshua Wuyts
98d9284e64
disable mdbook to allow tests to pass again (#159)
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2019-09-07 23:11:20 +02:00
Florian Gilcher
f27f927d1d
Merge pull request #156 from montekki/fs-fix-153
append doc example for io::buf_read::read_until
2019-09-07 00:03:42 +02:00
Fedor Sakharov
91a66c2d94
append doc example for io::buf_read::read_until 2019-09-06 21:58:53 +03:00
Atul Bhosale
5d73776c69 Use the latest toolchain with rustfmt available if rustfmt is unavailable on the latest nightly (#155) 2019-09-06 20:03:26 +02:00
Florian Gilcher
481002ee71
Merge pull request #152 from montekki/fs-fix-buf-read-docs
fixes docs for io::buf_read::read_until
2019-09-06 17:20:43 +02:00
Fedor Sakharov
a2c2413bc5
fixes docs for io::buf_read::read_until 2019-09-06 17:45:24 +03:00
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>
2019-09-06 12:08:51 +02:00
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.
2019-09-06 10:36:25 +01:00
Yuxuan Shui
2ca9c46b4b
Add tests for UnixDatagram from_raw_fd/into_raw_fd 2019-09-05 23:56:31 +01:00
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
2019-09-05 01:22:41 +02:00
Aleksey Kladov
75a4ba80cc
Merge pull request #144 from matklad/move-a-chat
move a-chat tutorial's code to this repo
2019-09-04 21:46:43 +03:00
Aleksey Kladov
5b96fa9daa move a-chat tutorial's code to this repo 2019-09-04 21:25:54 +03:00
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
2019-09-04 20:09:49 +02:00
Stjepan Glavina
1f7f318c36 Add bors.toml 2019-09-04 19:32:47 +02:00
Roman Proskuryakov
dde4b89369 Make Travis cfg pretty and modular (#118) 2019-09-03 09:09:05 +02:00
Shady Khalifa
bff10fe83b Stream::any implementation (#135)
* add stream::any method

* use `ret` macro and small improvements

* fix docs return type in `ret` macro
2019-09-01 19:58:16 +02:00
Yuki Okushi
532c73cf77 Fix typo in stability-guarantees.md (#136) 2019-08-31 16:15:26 +02:00
James Munns
e99eafe64f
Merge pull request #132 from shekohex/stream-all-method
Stream::all implementation
2019-08-31 13:10:02 +02:00
Jason Davies
a4d2cd1c82 Fix typo. (#134) 2019-08-31 11:36:34 +02:00
Shady Khalifa
e517c60fb1
remove comments 2019-08-30 20:32:03 +02:00
Shady Khalifa
e8860454e7
remove extra newline
Co-Authored-By: Yoshua Wuyts <yoshuawuyts+github@gmail.com>
2019-08-30 20:30:48 +02:00
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
2019-08-30 20:28:49 +02:00