Closed avocadochicken closed 10 months ago
Hey! Thanks for the PR.
I'm definitely interested adding some basic support for serde behind a feature flag.
I do think it would be nice to implement serialization as numbers instead of strings for StopBits
and CharSize
. That requires manual implementations, but I think it is worth it.
I do think it would be nice to implement serialization as numbers instead of strings for
StopBits
andCharSize
. That requires manual implementations, but I think it is worth it.
Meaning CharSize
returns number (u8
, usize
, ... ?) between 5 and 8? StopBits
returning 1 or 2, ...?
What about Parity
? How to encode odd
and even
? Or FlowControl
?
Tell me and I can make adjustments. But personally I am not against the idea of using strings.
For flow control and parity I would indeed stick with strings. But for char size and stop bits I think it would be nice to serialize as 5, 6, 7 or 8 and 1 or 2.
The backing number type doesn't really matter, it's just for serialization.
If it's ok to pull another crate see: ad345ff
Looks good in general. We can keep the repr()
even when the feature is disabled. Although I don't really like the extra dependency.
It's convenient, but if we do it manually it saves us some build time. If you want, please update the PR to make those changes. If you're busy, I can also get round to it soonTM.
I guess soonTM was today :)
Merging!
Thanks again for the PR!
Released with 0.2.9! :rocket:
Hello!
I am using this library like:
I need de-/serialization functionality on the
Settings
. This is why I added a feature "with-serde" to your library. In Cargo.toml:serial2 = { version = "0.2.8", features = ["with-serde"] }
Maybe you find it useful and want to merge it. Feel free to implement differently.