-
Notifications
You must be signed in to change notification settings - Fork 62
Replace fatfs::io
traits with embedded-io
traits
#84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
aedc2d3
to
b84cfa3
Compare
|
ec39e4a
to
b84cfa3
Compare
b84cfa3
to
19dfd73
Compare
Converting to draft as embedded-io needs to properly support |
the For example, the contract of the io traits doesn't specify all seeks/reads/writes have to be aligned to the block size, but for io implementations for block devices they have to be... |
Good point! When I used version 0.3 of this crate with |
Wrapper approach is probably better as I wouldn't want to have to conform to aligned reads for non block devices like EEPROMs. |
FYI |
|
I won't be updating this PR any longer, as I have decided to hard fork to add async support here: https://github.com/MabezDev/embedded-fatfs. My fork uses the embedded-io traits, if you need blocking support I'd happily accept a PR which adds a blocking layer over the async API. I hope this PR is still useful, anyone is welcome to salvage it to get e-io support in rust-fatfs. |
This slotted in fairly easily, due to how similar the two sets of traits were. The only real difference is how
UnexpectedEof
is handled. Previously this crate had methods on theIoError
trait to create anUnexpectedEof
error, in embedded-io theread_exact
method actually returns an entirely different enum, one which handles theUnexpectedEof
or other io errors.I believe this is a good change, for a number of reasons. Firstly embedded-io is almost a drop-in solution, and by switching more of the ecosystem can use this crate. embedded-io is established in the community and growing in popularity. embedded-io has a set of async traits which may allow this crate to take advantage of async io in the future.