1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use ::error::Result;

use super::response::Response;


#[derive(Debug)]
pub enum StoreResponse {
    Stored,
    NotStored,
    Exists,
    NotFound,
}


impl Response for StoreResponse {
    fn to_bytes(&self) -> Result<Vec<u8>> {
        use self::StoreResponse::*;

        Ok(match *self {
            Stored => b"STORED\r\n".to_vec(),
            NotStored => b"NOT_STORED\r\n".to_vec(),
            Exists => b"EXISTS\r\n".to_vec(),
            NotFound => b"NOT_FOUND\r\n".to_vec(),
        })
    }
}