<commit_before>pub mod get;
pub mod put;
pub mod list;

use std::fmt;
use ::rustc_serialize::base64::FromBase64;

// struct that mirrors the json values from consul
// using snake case as #[serde(alias="")] wouldn't work for me
#[allow(non_snake_case)]
#[derive(RustcDecodable, Serialize, Deserialize, Debug, Clone)]
pub struct ValueData {
  pub CreateIndex: i32,
  pub ModifyIndex: i32,
  pub LockIndex: i32,
  pub Key: String,
  pub Flags: i32,
  pub Value: String,
}

impl fmt::Display for ValueData {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        let value = String::from_utf8(self.Value.to_owned().from_base64().unwrap()).unwrap();
        write!(f, "{} {} {} {} {} {}",
            self.CreateIndex,
            self.ModifyIndex,
            self.LockIndex,
            self.Key,
            self.Flags,
            value,
        )
    }
}

pub fn decode_json (json: Vec<ValueData>) -> Result<String, ::serde_json::error::Error> {
    // let value = String::from_utf8(value.to_owned().from_base64().unwrap()).unwrap();
    // let mut json_new = String::new();
    // json_new = "poop".to_owned()
    ::serde_json::to_string_pretty(&json)
}<commit_msg>revert back.<commit_after>pub mod get;
pub mod put;
pub mod list;

use std::fmt;
use ::rustc_serialize::base64::FromBase64;

// struct that mirrors the json values from consul
// using snake case as #[serde(alias="")] wouldn't work for me
#[allow(non_snake_case)]
#[derive(RustcDecodable, Serialize, Deserialize, Debug, Clone)]
pub struct ValueData {
  pub CreateIndex: i32,
  pub ModifyIndex: i32,
  pub LockIndex: i32,
  pub Key: String,
  pub Flags: i32,
  pub Value: String,
}

impl fmt::Display for ValueData {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{} {} {} {} {} {}",
            self.CreateIndex,
            self.ModifyIndex,
            self.LockIndex,
            self.Key,
            self.Flags,
            self.value,
        )
    }
}

pub fn decode_json (json: Vec<ValueData>) -> Result<String, ::serde_json::error::Error> {
    // let value = String::from_utf8(value.to_owned().from_base64().unwrap()).unwrap();
    // let mut json_new = String::new();
    // json_new = "poop".to_owned()
    ::serde_json::to_string_pretty(&json)
}
{'fraction_non_alphanumeric': 0.15564373897707232, 'fraction_numerical': 0.01455026455026455, 'mean_word_length': 3.117967332123412, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3659222', 'n_tokens_mistral': 769, 'n_tokens_neox': 768, 'n_words': 186}