aboutsummaryrefslogtreecommitdiff
path: root/hello/src
diff options
context:
space:
mode:
authortilpner2018-09-25 16:29:49 +0200
committertilpner2018-09-25 16:30:17 +0200
commit498d9c36e4d55de478e180cd81845989ddd80eda (patch)
tree7acc75719223e74e08c23d7071d1376013928859 /hello/src
parent040ec873821d23e168a59b7ee21697fe0af5bb4c (diff)
downloadcarnix-cross-master.tar.gz
carnix-cross-master.tar.xz
carnix-cross-master.zip
Add serde_json to hello, make building a little more realisticHEADmaster
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);
}