MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / parse_inline_command

Function parse_inline_command

nodedb/src/control/server/resp/codec.rs:322–329  ·  view source on GitHub ↗

Parse an inline command (plain text) into a RESP array of bulk strings.

(line: &[u8])

Source from the content-addressed store, hash-verified

320
321/// Parse an inline command (plain text) into a RESP array of bulk strings.
322fn 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)]
332mod tests {

Callers 1

try_parseMethod · 0.85

Calls 5

collectMethod · 0.80
try_parseMethod · 0.80
to_vecMethod · 0.45
as_bytesMethod · 0.45
feedMethod · 0.45

Tested by

no test coverage detected