Closed ajmcquilkin closed 7 months ago
Serde also lets you define a surrogate of the struct, and use that to define serialization.
Note that this is not easily possible with the current design: the Settings
struct wraps a full termios
struct on Unix and a DBC
struct on Windows.
This contains a lot of un-exposed and platform specific settings. So it's basically not possible to make a Settings
object out of thin air without having an actual serial port opened.
The idea behind this was to allow more easily exposing platform specific settings in the future.
Support for serde
was added to CharSize
, StopBits
, Parity
and FlowControl
with PR #19 and released in v0.2.9
(thanks @avocadochicken !).
Thats the best we can do since Settings
itselfs wraps a raw OS settings object.
I hope this helps with your use case! You will need to enable the serde
feature to use it.
Thanks for your work on the repo! I'm using
serial2
on a Tauri application, and I'm looking to allow users to configure a serial port over a JSON API. I would be looking to allow users to set the following fields via this API:CharSize
FlowControl
Parity
StopBits
I'm imagining this could be possible via a
serde
feature on the crate. Happy to contribute to this if this isn't something the project has time to implement.