pub fn read(cli_matches: &ArgMatches) -> Self {
        let files: Vec<String>;
        match cli_matches.values_of("file") {
            None => panic!("no configuration files specified"),
            Some(val) => {
                files = val.map(|s| s.to_string()).collect();
            }
        };

        let mut contents = String::new();
        for file in files.iter() {
            println!("decoding {}", file);

            // Read the file.
            let body = fs::read_to_string(file).expect("reading the file failed");

            // Append the body of the file to the rest of the contents.
            contents.push_str(&body);
        }

        // Decode the contents.
        let config: Config = toml::from_str(&contents).unwrap();

        config
    }
/// Read and decode the config from the files that are passed on the command line.
Read and decode the config from the files that are passed on the command line.
Read and decode the config from the files that are passed on the command line .
pub fn read(cli_matches: &ArgMatches) -> Self {
        let files: Vec<String>;
        match cli_matches.values_of("file") {
            None => panic!("no configuration files specified"),
            Some(val) => {
                files = val.map(|s| s.to_string()).collect();
            }
        };
        let mut contents = String::new();
        for file in files.iter() {
            println!("decoding {}", file);
            // Read the file.
            let body = fs::read_to_string(file).expect("reading the file failed");
            // Append the body of the file to the rest of the contents.
            contents.push_str(&body);
        }
        // Decode the contents.
        let config: Config = toml::from_str(&contents).unwrap();
        config
    }
pub fn read ( cli_matches : & ArgMatches ) -> Self { let files : Vec < String > ; match cli_matches . values_of ( " " ) { None => panic ! ( " " ) , Some ( val ) => { files = val . map ( | s | s . to_string ( ) ) . collect ( ) ; } } ; let mut contents = String :: new ( ) ; for file in files . iter ( ) { println ! ( " " file ) ; // Read the file. let body = fs :: read_to_string ( file ) . expect ( " " ) ; // Append the body of the file to the rest of the contents. contents . push_str ( & body ) ; } // Decode the contents. let config : Config = toml :: from_str ( & contents ) . unwrap ( ) ; config }
Read and decode the config from the files that are passed on the command line.
Read and decode the config from the files that are passed on the command line .
cli_matches
&ArgMatches
cli_matches
&ArgMatches