Created
February 18, 2019 19:51
-
-
Save Licenser/b9e3c3f014563d91efd9a0e2616590d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "j2m" | |
version = "0.1.0" | |
edition = "2018" | |
[dependencies] | |
base64 = "*" | |
serde = "*" | |
serde_json = "*" | |
rmp-serde = "*" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use base64; | |
use rmp_serde as rmps; | |
use serde::Serialize; | |
use serde_json; | |
use std::io::{self, BufRead}; | |
fn main() { | |
let stdin = io::stdin(); | |
for line in stdin.lock().lines() { | |
let line = line.unwrap(); | |
let j: serde_json::Value = serde_json::from_str(&line).unwrap(); | |
let m = rmps::to_vec(&j).unwrap(); | |
println!("{}", base64::encode(&m)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment