summaryrefslogtreecommitdiff
path: root/src/data.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/data.rs')
-rw-r--r--src/data.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/data.rs b/src/data.rs
new file mode 100644
index 0000000..ee39613
--- /dev/null
+++ b/src/data.rs
@@ -0,0 +1,27 @@
+use serde_json::{Value, Map};
+use handlebars_iron::handlebars::to_json;
+
+#[derive(Serialize, Debug)]
+pub struct Quote {
+ id: u64,
+ author: String,
+ date: String,
+ score: String,
+ votes: u32,
+ content: String
+}
+
+pub fn make_data() -> Map<String, Value> {
+ let mut data = Map::new();
+ data.insert("quotes".to_string(), to_json(&vec!(
+ &Quote {
+ id: 1,
+ author: "panda_man".to_owned(),
+ date: "2017-07-01".to_owned(),
+ score: format!("{:.2}", 450.0 / 96.0),
+ votes: 99,
+ content: "<orbekk> hvor er jantho?".to_owned(),
+ }
+ )));
+ data
+}