pub fn read_properties<R: BufRead>(
    reader: &mut R
) -> Result<Properties, PropertiesParseError>
Examples found in repository?
examples/read-properties.rs (line 31)
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fn main() {
    let args: Vec<String> = env::args().collect();

    let [program_name, args @ ..] = &args[..] else {
        unreachable!("Who wouldn't give me a program name?!");
    };

    if args.is_empty() {
        eprintln!("Usage: {} <paths to .properties files...>", program_name);
        std::process::exit(1);
    }

    for props_path in args {
        println!("\nReading {:?}", &props_path);

        let file = match File::open(props_path) {
            Ok(file) => file,
            Err(e) => {
                eprintln!("IO error: {}", e);
                continue;
            }
        };

        let mut reader = BufReader::new(file);
        match read_properties(&mut reader) {
            Ok(properties) => println!("{:#?}", properties),
            Err(e) => eprintln!("Parsing error: {}", e),
        }
    }
}