/// Encodes a slice of string to RESP binary buffer.
/// It is use to create a request command on redis client.
/// # Examples
/// ```
/// # use self::resp::encode_slice;
/// let array = ["SET", "a", "1"];
/// assert_eq!(encode_slice(&array),
///            "*3\r\n$3\r\nSET\r\n$1\r\na\r\n$1\r\n1\r\n".to_string().into_bytes());
/// ```
Encodes a slice of string to RESP binary buffer.
It is use to create a request command on redis client.
Encodes a slice of string to RESP binary buffer . It is use to create a request command on redis client .
pub fn encode_slice(slice: &[&str]) -> Vec<u8> {
    let array: Vec<Value> = slice.iter().map(|string| Value::Bulk(string.to_string())).collect();
    let mut res: Vec<u8> = Vec::new();
    buf_encode(&Value::Array(array), &mut res);
    res
}
pub fn encode_slice ( slice : & [ & str ] ) -> Vec < u8 > { let array : Vec < Value > = slice . iter ( ) . map ( | string | Value :: Bulk ( string . to_string ( ) ) ) . collect ( ) ; let mut res : Vec < u8 > = Vec :: new ( ) ; buf_encode ( & Value :: Array ( array ) , & mut res ) ; res }
Encodes a slice of string to RESP binary buffer.
Encodes a slice of string to RESP binary buffer .
slice
&[&str]
examples
None
use self::resp::encode_slice;
None