Skip to content

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

@Conaclos

Description

@Conaclos

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.

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