aboutsummaryrefslogtreecommitdiff
path: root/hello/src
diff options
context:
space:
mode:
Diffstat (limited to 'hello/src')
-rw-r--r--hello/src/main.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/hello/src/main.rs b/hello/src/main.rs
index e7a11a9..e5ad212 100644
--- a/hello/src/main.rs
+++ b/hello/src/main.rs
@@ -1,3 +1,15 @@
+extern crate serde;
+#[macro_use]
+extern crate serde_derive;
+extern crate serde_json;
+
+#[derive(Serialize)]
+struct Foo {
+ bar: i32
+}
+
fn main() {
- println!("Hello, world!");
+ let s = serde_json::to_string(&Foo { bar: 42 })
+ .expect("Unable to serialize foo");
+ println!("{}", s);
}