buffer_to_array

Function buffer_to_array 

Source
pub fn buffer_to_array(buf: &mut BytesMut) -> Vec<String>
Expand description

Receives buffer and converts it to vector of strings.

Splits the buffer on space characters. Note that this simple implementation doesn’t handle quoted strings or escaping.

§Arguments

  • buf - The buffer to parse. Will be consumed.

§Returns

A vector of strings, split by spaces.

§Example

let mut buf = BytesMut::from("set key value");
let parts = buffer_to_array(&mut buf);
assert_eq!(parts, vec!["set", "key", "value"]);