tyozo 0.1.0

in-memory key-value store
Documentation
#[derive(PartialEq, PartialOrd, Debug, Clone)]
pub enum Command {
    Set { key: String, value: String },
    SetNX { key: String, value: String },
    Get { key: String },
    Del { keys: Vec<String> },
    Multi,
    Exec,
    Abort,
    Shutdown,
}

impl ToString for Command {
    fn to_string(&self) -> String {
        use self::Command::*;

        match self {
            Set { key, value } => format!("set {} {}", key, value),
            SetNX { key, value } => format!("setnx {} {}", key, value),
            Get { key } => format!("get {}", key),
            Del { keys } => format!(
                "del {}",
                keys.iter()
                    .fold(String::new(), |acc, s| format!("{} {}", acc, s))
            ),
            _ => todo!(),
        }
    }
}