Skip to main content

split_lines

Function split_lines 

Source
pub fn split_lines(text: &str) -> Vec<String>
Expand description

Split buffer into non-empty trimmed lines (handles \r\n, \n and a lone \r: V.250 §5.7.1 ends a numeric ATV0 result code, and the echo, with S3 only).

Two modem quirks are undone here, so every caller sees the same lines:

  • a final result glued to the next URC without CRLF (OK+CUSD: …) becomes two lines;
  • the quoted text of a +CUSD: may carry raw \r/\n (USSD menus): the line stays open until the quote closes. A result code, another +XXX: line or 2 KiB end an unclosed quote early (truncated +CUSD). Inside a +CUSD line CR/LF are kept.