aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYigit Sever2021-04-19 18:25:55 +0300
committerYigit Sever2021-04-19 18:25:55 +0300
commitcbf39d34ff56ac80b5683758bdcb3b24829a946d (patch)
tree8fe3bdfea6bff78d269d1f297ca13a4b04048632
parentdf6fa5f322fc972b3894e720f2c406eb2d8f5f5a (diff)
downloadgradecoin-cbf39d34ff56ac80b5683758bdcb3b24829a946d.tar.gz
gradecoin-cbf39d34ff56ac80b5683758bdcb3b24829a946d.tar.bz2
gradecoin-cbf39d34ff56ac80b5683758bdcb3b24829a946d.zip
Add serde example
-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}