Age | Commit message (Collapse) | Author | |
---|---|---|---|
2020-12-03 | util: add writev-aware `poll_write_buf` (#3156) | Eliza Weisman | |
## Motivation In Tokio 0.2, `AsyncRead` and `AsyncWrite` had `poll_write_buf` and `poll_read_buf` methods for reading and writing to implementers of `bytes` `Buf` and `BufMut` traits. In 0.3, these were removed, but `poll_read_buf` was added as a free function in `tokio-util`. However, there is currently no `poll_write_buf`. Now that `AsyncWrite` has regained support for vectored writes in #3149, there's a lot of potential benefit in having a `poll_write_buf` that uses vectored writes when supported and non-vectored writes when not supported, so that users don't have to reimplement this. ## Solution This PR adds a `poll_write_buf` function to `tokio_util::io`, analogous to the existing `poll_read_buf` function. This function writes from a `Buf` to an `AsyncWrite`, advancing the `Buf`'s internal cursor. In addition, when the `AsyncWrite` supports vectored writes (i.e. its `is_write_vectored` method returns `true`), it will use vectored IO. I copied the documentation for this functions from the docs from Tokio 0.2's `AsyncWrite::poll_write_buf` , with some minor modifications as appropriate. Finally, I fixed a minor issue in the existing docs for `poll_read_buf` and `read_buf`, and updated `tokio_util::codec` to use `poll_write_buf`. Signed-off-by: Eliza Weisman <eliza@buoyant.io> | |||
2020-11-01 | util: add back public poll_read_buf() function (#3079) | Dirkjan Ochtman | |
This was accidentally removed in #3064. | |||
2020-10-29 | util: deduplicate implementations of poll_read_buf() (#3064) | Dirkjan Ochtman | |
2020-10-27 | Revert "util: upgrade tokio-util to bytes 0.6 (#3052)" (#3060) | Carl Lerche | |
This reverts commit fe2b997. We are avoiding adding poll_read_buf to tokio itself for now. The patch is reverted now in order to not block the v0.3.2 release (#3059). | |||
2020-10-27 | util: upgrade tokio-util to bytes 0.6 (#3052) | Dirkjan Ochtman | |
2020-10-20 | util: prevent read buffer from being swapped during a read_poll (#2993) | John-John Tedro | |
2020-10-19 | util: add a poll_read_buf shim to tokio-util (#2972) | John-John Tedro | |
2020-10-12 | io: Rename `ReadBuf` methods (#2945) | Lucio Franco | |
This changes `ReadBuf::add_filled` to `ReadBuf::advance` and `ReadBuf::append` to `ReadBuf::put_slice`. This is just a mechanical change. Closes #2769 | |||
2020-09-24 | io: remove poll_{read,write}_buf from traits (#2882) | Carl Lerche | |
These functions have object safety issues. It also has been decided to avoid vectored operations on the I/O traits. A later PR will bring back vectored operations on specific types that support them. Refs: #2879, #2716 | |||
2020-09-08 | io: move StreamReader and ReaderStream into tokio_util (#2788) | Alice Ryhl | |
Co-authored-by: Mikail Bagishov <bagishov.mikail@yandex.ru> Co-authored-by: Eliza Weisman <eliza@buoyant.io> |