pub fn parse_command(
buf: &[u8],
) -> Result<Option<(Command, usize)>, ProtocolError>Expand description
Attempt to parse one command from the front of buf.
Ok(Some((cmd, consumed)))— a full command;consumedbytes may be dropped.Ok(None)— need more bytes; call again after reading more.Err(_)— the stream is corrupt; the caller should reply with an error and close the connection.
This is the convenience form that allocates a fresh Argv per call. The
reactor’s hot path uses parse_command_into with a reused scratch
Argv to keep per-cmd malloc rate at 0.