Expand description
Conversion helpers between rtcom_config’s string-based
Profile and rtcom_core’s typed SerialConfig /
LineEndingConfig.
The profile layer persists each field as a stable TOML string
("none", "even", "crlf", …) so hand-edited files survive
refactors in rtcom-core’s enums. This module bridges the two
representations in both directions:
serial_section_to_config/serial_config_to_section— serial framing round-trip.line_endings_from_profile— pulls the three line-ending mappers out of a profile’s[line_endings]section.
Unknown strings fall through to sensible defaults rather than
erroring: a hand-edited parity = "quantum" must never crash rtcom.
Both rtcom-cli (at startup) and rtcom-tui::run (when applying
DialogAction::ReadProfile or writing back on ApplyAndSave) lean
on these helpers, which is why they live in the shared rtcom-tui
crate.
Functions§
- line_
ending_ config_ to_ section - Project a runtime
LineEndingConfiginto its TOML-facingLineEndingsSectionrepresentation (used when persisting onDialogAction::ApplyLineEndingsAndSave). - line_
endings_ from_ profile - Pull the three line-ending mappers out of a profile’s
[line_endings]section. Unknown strings fall through toLineEnding::None. - parse_
line_ ending - Parse a profile-string line-ending rule into
LineEnding. Unknown strings fall through toLineEnding::None. - serial_
config_ to_ section - Project a runtime
SerialConfigback into its TOML-facingSerialSectionrepresentation (used when persisting on--saveorDialogAction::ApplyAndSave). - serial_
section_ to_ config - Project a profile
[serial]section into a runtimeSerialConfig.