print_content/
print-content.rs

1use std::env;
2use std::process::exit;
3
4fn main() {
5    let args: Vec<String> = env::args().collect();
6    let filename = match args.get(1) {
7        Some(arg) => arg,
8        None => {
9            println!("Expected a path to a file as first argument.");
10            exit(-1);
11        }
12    };
13
14    let mut reader = shapefile::Reader::from_path(filename).unwrap();
15
16    for result in reader.iter_shapes_and_records() {
17        let (shape, record) = result.unwrap();
18        println!("Shape: {}, records: ", shape);
19        for (name, value) in record {
20            println!("\t{}: {:?}, ", name, value);
21        }
22        println!();
23    }
24}