-
Notifications
You must be signed in to change notification settings - Fork 29
Description
Howdy!
I'm wanting to use this crate to process ANSI-colored lines from serial port-connected devices. In scenarios with serial devices, it's not uncommon for baud rates to be mismatched. For example, some microcontrollers like the ESP8266 have bootloader output with a static baud rate, and user code can run with any baud after that, even changing during runtime. In those scenarios, I'd much rather have a "best-effort output" rather than writing off the whole input buffer as invalid.
As such, I'm requesting the addition of methods that use String::from_utf8_lossy and potentially simdutf8::compat::from_utf8, replacing damaged/incorrect characters with the Unicode Replacement Character (�).
I haven't seen any other examples of the nom parser being used nor have I had any personal experience with it yet, so I can't instantly spot the best way to implement these.
A couple other things that I might consider raising issues for/attempt myself at a later date, if they're not deemed out of scope are:
- Methods that return
Lines instead ofText. (Presently I have to extract theLineoutText's internal vector to perform wrapping operations on it) - Support for the
\r+\x1B[Ksequence, clearing the contents of the current line (in practice, slicing into the input buffer at a later index).