Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

io: `ErrorType` could be split into `Read::Error`, `Write::Error` and `Seek::Error`.

Open
#693 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust
Domain
embedded-iot

Research direction

Start by locating the definitions and implementations of the Read, Write, Seek, BufRead, ReadReady, and WriteReady traits. Review how ErrorType is currently shared and identify the existing tests or examples covering these traits. Done means the proposed error separation and supertrait relationships are agreed upon and consistently represented in the project.

Written by the indexing model from the issue text.

Description

While I Implemented Read and Write on a custom type, I noticed that the errors that can happen during Read are not always the same as the errors that happen during write.
For example, if you implement a Cursor type like the one in std::io, read cannot fail, while write can fail if the storage is full.

I propose to remove ErrorType and simply add an associated type Error to Read, Write and Seek. We don't have to add one to BufRead because it is a super trait of Read. We could make ReadReady and WriteReady super traits of Read and Write respectively.

I think this makes the code more flexible and idiomatic. This also looks more consistent with the approach of mebedded-hal of favoring fine-grained errors.

Dominant language
Rust
Stars
2.7k
Forks
283
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rust-embedded/embedded-hal

All issues in rust-embedded/embedded-hal

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.