Skip to content
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

feat: implement embedded-io and embedded-io-async traits #58

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

elrafoon
Copy link

@elrafoon elrafoon commented May 6, 2024

Allows much better interoperatibility with other embedded rust projects, which by now usually have support for embedded-io traits.

Of course this is feature-gated.

Allows much better interoperatibility with other embedded rust projects,
which by now usually have support for embedded-io traits.
@robin-nitrokey
Copy link
Member

Thanks for the PR! Some initial thoughts:

  • Why not implement these on File directly? AFAIS that’s the only struct implementing the littlefs2::io::* traits. That would be more ergonomic than having to create wrapper structs.
  • Then it would also make sense to have a Seek implementation.
  • Maybe we should just use the embedded-io traits instead of our own? I’ll run some tests how that would affect binary size, if at all.
  • Is it really useful to have an async implementation if it just calls the blocking trait?

@Sympatron
Copy link

Sympatron commented May 7, 2024

  • Is it really useful to have an async implementation if it just calls the blocking trait?

Adding async implementations that are not really async is useless and confusing IMO.
When I call an async function my expectation is that this function will not block.
And it also does not really add anything, because nothing prevents you from calling the sync version from an async function anyway.

This would only be useful if littlefs2 would allow users to provide an AsyncStorage.

@sosthene-nitrokey
Copy link
Contributor

async littlefs will not be an option until the upstream C project has some form of support for async operations. That seems unlikely to happen soon.

The most likely way to obtain support for async littlefs would be to re-implement it in native Rust, rather than relying on the upstream C implementation. Since trussed is written with synchronous implementations, this is unlikely to be in scope of this crate for a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants