rust-embedded-community / embedded-storage

An Embedded Storage Abstraction Layer
Apache License 2.0
63 stars 21 forks source link

Async capacity #54

Open avsaase opened 1 month ago

avsaase commented 1 month ago

Closes #37

Should the blocking version also be fallible?

MathiasKoch commented 1 month ago

As I said in the issue, I am personally okay with this change.

Not sure about others? CC @lulf @Dirbaio @eldruin ?

Dirbaio commented 1 month ago

is this to support flashes where you query the size by doing e.g. an SPI operation which requires async?

I think in general it'd be better to read it in new() and cache it in a field, then .capacity() can just return that and needs no async. This'd probably help perf, especially if you're using the capacity in read/write/erase to do bounds checks, so you don't do an extra spi transaction to read the capacity every time.