This repository has been archived by the owner on Oct 18, 2022. It is now read-only.
Make BlockDevice depend on Write<u8> to remove mutable reference on write buffer #30
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi!
I ran into the issue of write_bytes taking a &mut [u8], because the Transfer trait requires it.
The nRF52-hal SPI drivers appear to implement Write<_> at least, so I made the BlockDevice trait depend on that so write_bytes can be non-mutable.
This required some reorganisation of the Error type to receive the SPI Error type, as both Transfer and Write have their own associated Error type.
I might've missed some implications of depending on the Write trait, as I assumed that anything that implements Transfer, should have no problem implementing Write.