pub fn new(mut args: std::env::Args) -> Result<Config, &'static str> {
        // ignore name of program (https://doc.rust-lang.org/book/ch12-01-accepting-command-line-arguments.html#reading-the-argument-values)
        args.next();

        let query = match args.next() {
            Some(arg) => arg,
            None => return Err("Didn't get a query string"),
        };

        let filename = match args.next() {
            Some(arg) => arg,
            None => return Err("Didn't get a file name"),
        };

        let case_sensitive = env::var("CASE_INSENSITIVE").is_err();

        Ok(Config { query, filename, case_sensitive })
    }
// `mut args` because iterating over an iterator mutates the iterator (https://doc.rust-lang.org/book/ch13-02-iterators.html#the-iterator-trait-and-the-next-method)
// `&'static str` because the error message type is a string literal (https://doc.rust-lang.org/book/ch10-03-lifetime-syntax.html#the-static-lifetime)
`mut args` because iterating over an iterator mutates the iterator
`&'static str` because the error message type is a string literal
` mut args ` because iterating over an iterator mutates the iterator ` & ' static str ` because the error message type is a string literal
pub fn new(mut args: std::env::Args) -> Result<Config, &'static str> {
        // ignore name of program (https://doc.rust-lang.org/book/ch12-01-accepting-command-line-arguments.html#reading-the-argument-values)
        args.next();
        let query = match args.next() {
            Some(arg) => arg,
            None => return Err("Didn't get a query string"),
        };
        let filename = match args.next() {
            Some(arg) => arg,
            None => return Err("Didn't get a file name"),
        };
        let case_sensitive = env::var("CASE_INSENSITIVE").is_err();
        Ok(Config { query, filename, case_sensitive })
    }
pub fn new ( mut args : std :: env :: Args ) -> Result < Config , & ' static str > { // ignore name of program (https://doc.rust-lang.org/book/ch12-01-accepting-command-line-arguments.html#reading-the-argument-values) args . next ( ) ; let query = match args . next ( ) { Some ( arg ) => arg , None => return Err ( " " ) , } ; let filename = match args . next ( ) { Some ( arg ) => arg , None => return Err ( " " ) , } ; let case_sensitive = env :: var ( " " ) . is_err ( ) ; Ok ( Config { query , filename , case_sensitive } ) }
`mut args` because iterating over an iterator mutates the iterator (https://doc.rust-lang.org/book/ch13-02-iterators.html#the-iterator-trait-and-the-next-method)
`&'static str` because the error message type is a string literal (https://doc.rust-lang.org/book/ch10-03-lifetime-syntax.html#the-static-lifetime)
` mut args ` because iterating over an iterator mutates the iterator ( https : // doc . rust - lang . org / book / ch13 - 02 - iterators . html#the - iterator - trait - and - the - next - method ) ` & ' static str ` because the error message type is a string literal ( https : // doc . rust - lang . org / book / ch10 - 03 - lifetime - syntax . html#the - static - lifetime )
args
std::env::Args