Parse an inline command (plain text) into a RESP array of bulk strings.
(line: &[u8])
| 320 | |
| 321 | /// Parse an inline command (plain text) into a RESP array of bulk strings. |
| 322 | fn parse_inline_command(line: &[u8]) -> RespValue { |
| 323 | let text = String::from_utf8_lossy(line); |
| 324 | let parts: Vec<RespValue> = text |
| 325 | .split_whitespace() |
| 326 | .map(|s| RespValue::bulk(s.as_bytes().to_vec())) |
| 327 | .collect(); |
| 328 | RespValue::Array(Some(parts)) |
| 329 | } |
| 330 | |
| 331 | #[cfg(test)] |
| 332 | mod tests { |