Skip to content
This repository was archived by the owner on May 6, 2018. It is now read-only.
This repository was archived by the owner on May 6, 2018. It is now read-only.

Consider Removing the io::Read and io::Write supertraits on AsyncRead and AsyncWrite #83

@cramertj

Description

@cramertj

Many of the methods on io::Read and io::Write, such as write_all, are not appropriate to call in an async context. Furthermore, lots of code using io::Read and io::Write expects (correctly or not) that those interfaces are blocking. Removing the supertraits would make it harder to misuse the AsyncRead and AsyncWrite types as io::Read and io::Write types, and would allow moving the io::XXX functions to methods on the AsyncRead and AsyncWrite traits (this last point is a benefit because methods are more easily discoverable than free functions). This change could also allow AsyncRead and AsyncWrite types with non-io::Error error types.

There are places in which it makes sense to provide an async-readable/writeable type as an io::Read or io::Write. That functionality can still be provided by choosing to opt-in to an io::Read or io::Write impl, or by using some form of wrapper type which allows using an AsyncRead/AsyncWrite as an io::Read/io::Write (basically the inverse of #76).

cc @carllerche

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions