io: remove bytes
dependency from the tokio
public API
#2735
Labels
A-tokio
Area: The main tokio crate
C-proposal
Category: a proposal and request for comments
M-io
Module: tokio/io
Milestone
Summary
The
bytes
crate is not yet at 1.0. Removingbytes
from the Tokio public API will enable us to ship faster. It will also allow bothbytes
and Tokio to experiment with additional potential APIs before stabilizing. Any utility currently intokio
that usesbytes
types as part of the public API is moved totokio-util
.Motivation
Tokio aims to release 1.0 by the end of 2020. Any type from external crates available as part of the Tokio public API must follow the same guarantees as Toko. The
bytes
crate is not currently at a 1.0. While we could attempt to reach a bytes 1.0 release, doing so is risky for a few reasons.io_uring
integration (io: propose new AsyncRead / AsyncWrite traits #2716) that we need additional / differentBuf
/BufMut
APIs.Removing
bytes
as a public dependency for the initial 1.0 release would be relatively straightforward as it is not used as #2716 proposes to remove it from the main core API.Proposal
All utilities that use
bytes
are moved totokio-util
until they can be stabilized. This includes:AsyncRead::read_buf
AsyncWrite::write_buf
Stream::collect()
forbytes
types.stream_reader
AsyncReadExt
andAsyncWriteExt
traits are added totokio-util
(read / write helpers intokio
are moved toAsyncRead
/AsyncWrite
proper).The loss of
StreamExt::collect
will be the most immediately impactful. We could addStreamExt::collect_buf()
(naming TBD) intokio-util
.The text was updated successfully, but these errors were encountered: