From 498d9c36e4d55de478e180cd81845989ddd80eda Mon Sep 17 00:00:00 2001 From: tilpner Date: Tue, 25 Sep 2018 16:29:49 +0200 Subject: Add serde_json to hello, make building a little more realistic --- hello/src/main.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'hello/src') 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); } -- cgit v1.2.3