aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorYigit Sever2021-04-19 18:25:55 +0300
committerYigit Sever2021-04-19 18:25:55 +0300
commitc6ee046a3ba1f68eb4ba5cb0378858a071e122d8 (patch)
tree286e7a3e49da7123e2064a89a49ce5d3da914584 /examples
parent81ebd267c89011ca65cd5cfe382e10fabd9017ac (diff)
downloadgradecoin-c6ee046a3ba1f68eb4ba5cb0378858a071e122d8.tar.gz
gradecoin-c6ee046a3ba1f68eb4ba5cb0378858a071e122d8.tar.bz2
gradecoin-c6ee046a3ba1f68eb4ba5cb0378858a071e122d8.zip
Add serde example
Diffstat (limited to 'examples')
-rw-r--r--examples/serdeser.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/serdeser.rs b/examples/serdeser.rs
new file mode 100644
index 0000000..60d90b9
--- /dev/null
+++ b/examples/serdeser.rs
@@ -0,0 +1,17 @@
1use gradecoin::schema::Transaction;
2use serde_json;
3
4pub fn main() {
5
6 let tx = Transaction {
7 by: "fingerprint_of_some_guy".to_owned(),
8 source: "31415926535897932384626433832795028841971693993751058209749445923".to_owned(),
9 target: "fingerprint_of_some_guy".to_owned(),
10 amount: 2,
11 timestamp: chrono::NaiveDate::from_ymd(2021, 04, 13).and_hms(20, 55, 30),
12 };
13
14 let tx_string = serde_json::to_string(&tx).unwrap();
15
16 println!("{}", &tx_string);
17}