Skip to content

Consider Replacing/Augmenting embedded-io(-*) with alloc::io and futures-io #747

Description

@bushrat011899

Background

With rust-lang/rust#154046 implemented, nightly now has a full implementation of std::io available from alloc::io, and a partial implementation available from core::io. With that, other crates such as futures-io can gain no_std support, potentially making them viable in the embedded space.

Proposal

  • Increase MSRV to whatever version contains a stabilized alloc::io & core::io.
  • Directly use core::io and (where required) alloc::io for synchronous I/O.
  • Use futures-io for asynchronous I/O.
  • Deprecate embedded-io, embedded-io-adapters, and embedded-io-async.

Drawbacks

  • Read and BufRead are currently only available from alloc::io. embedded-io provides alternatives to those traits even without the alloc feature enabled, so using the standard library I/O traits would increase the need for downstream crates to enable the alloc feature.
  • embedded-io allows changing the error type used for I/O operations, whereas the standard library traits use core::io::Error exclusively.
  • embedded-io guarantees its trait implementations are blocking, deferring non-blocking support to ReadReady and WriteReady. These traits could remain, or embedded-hal could move towards the standard library approach of mixed non-/blocking.

Benefits


Notes

  • I'm one of the contributors working on alloc_io and core_io. I'm opening this issue to gauge interest in a standard library implementation of no_std I/O, and whether it may be suitable for stabilization.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions