1 extern crate stud_rust_base;
2 use stud_rust_base::io::*;
6 let mut args = env::args();
9 match &args.collect::<Vec<String>>()[..] {
10 [data_type, input] => {
11 match data_type.as_ref() {
12 "i8" => print_values(Vec::<i8>::load_from(input).expect("Failed to read from input")),
13 "u8" => print_values(Vec::<u8>::load_from(input).expect("Failed to read from input")),
14 "i16" => print_values(Vec::<i16>::load_from(input).expect("Failed to read from input")),
15 "u16" => print_values(Vec::<u16>::load_from(input).expect("Failed to read from input")),
16 "i32" => print_values(Vec::<i32>::load_from(input).expect("Failed to read from input")),
17 "u32" => print_values(Vec::<u32>::load_from(input).expect("Failed to read from input")),
18 "i64" => print_values(Vec::<i64>::load_from(input).expect("Failed to read from input")),
19 "u64" => print_values(Vec::<u64>::load_from(input).expect("Failed to read from input")),
20 "f32" => print_values(Vec::<f32>::load_from(input).expect("Failed to read from input")),
21 "f64" => print_values(Vec::<f64>::load_from(input).expect("Failed to read from input")),
22 "int8" => print_values(Vec::<i8>::load_from(input).expect("Failed to read from input")),
23 "uint8" => print_values(Vec::<u8>::load_from(input).expect("Failed to read from input")),
24 "int16" => print_values(Vec::<i16>::load_from(input).expect("Failed to read from input")),
25 "uint16" => print_values(Vec::<u16>::load_from(input).expect("Failed to read from input")),
26 "int32" => print_values(Vec::<i32>::load_from(input).expect("Failed to read from input")),
27 "uint32" => print_values(Vec::<u32>::load_from(input).expect("Failed to read from input")),
28 "int64" => print_values(Vec::<i64>::load_from(input).expect("Failed to read from input")),
29 "uint64" => print_values(Vec::<u64>::load_from(input).expect("Failed to read from input")),
30 "float32" => print_values(Vec::<f32>::load_from(input).expect("Failed to read from input")),
31 "float64" => print_values(Vec::<f64>::load_from(input).expect("Failed to read from input")),
34 panic!("Unknown data_type {}", data_type);
40 panic!("Invalid input")
46 eprintln!("Usage: decode_vector data_type input_vector_file
48 Reads binary data from input_vector_file and writes the data to the standard output. data_type can be one of
63 use std::fmt::Display;
65 fn print_values<T>(values: Vec<T>) where