jamesmunns / postcard

A no_std + serde compatible message library for Rust
Apache License 2.0
788 stars 76 forks source link

#118 Add support for latest embedded-io #123

Closed elast0ny closed 6 months ago

elast0ny commented 6 months ago

This adds a new embedded-io-06 feature which allows users to use the latest embedded_io v 0.6.*.

Backwards compatibility is maintained with the previous embedded-io which is now setup to activate the embedded-io-04 feature internally.

netlify[bot] commented 6 months ago

Deploy Preview for cute-starship-2d9c9b canceled.

Name Link
Latest commit 46124bbd7e1e81d179500625a789e306f247b78c
Latest deploy log https://app.netlify.com/sites/cute-starship-2d9c9b/deploys/65a07047dc4b76000849f899
jamesmunns commented 6 months ago

Thank you @elast0ny! I'm not 100% I want to use the pattern you did, of mutually exclusive features. I may want to instead offer both, in separate modules, with the existing embedded-io meaning 0.4, and mark it as deprecated.

See also #115 and #121. I'll want to be consistent with whatever I decide for the version bump.

elast0ny commented 6 months ago

Thanks for the quick reply ! I needed support for v0.6 so I'll probably go on and use my fork given that this depends on some design decisions and #115 / #121 being resolved.

Let me know when you have a concrete path forward for this and I'll see if I can update my branch/PR !

Edit :

offer both, in separate modules

This would be nice but may lead to lots of duplicated impls (unless we write some macro-foo that swaps the trait bounds for each embedded-io version).

For example, you might need to copy paste the implementation of EIOReader for each version included so that it can have the proper embedded_io::*::Read bound. The bummer is that most/all of those impls will work exactly the same (calling reader.read()) regardless of what "incompatible" Read trait we use.

jamesmunns commented 6 months ago

I'm going to merge this and then move it around a bit, thank you @elast0ny!

elast0ny commented 6 months ago

No problem ! Just as an FYI, I've opened https://github.com/rust-embedded/embedded-hal/issues/566 to see if we cant get a "stable" embedded-io release. It would be nice if the ecosystem would converge to a 1.0.0 that will hopefully stick around for a long time.