Struct minigrep_test_package_001::Config [−][src]
Expand description
A fully valid minigrep
command. Consists of a query
to search for, a filename
to search within,
and a case_sensitive
boolean to specify whether the search should ignore case or not
Fields
query: String
the query to search for
filename: String
the file to search within
case_sensitive: bool
whether query should be case sensitive or not
Implementations
Attempt to create a new Config
from given arguments.
Examples
use std::{env, process}; use minigrep::Config; // try to parse CLI arguments into minigrep config; let config = Config::new(env::args()).unwrap_or_else(|err| { // if fail: convey error and exit eprintln!("Problem parsing arguments: {}", err); process::exit(1); });
Errors
- return
Err(string)
if a query string is missing from the args - return
Err(string)
if a file name is missing from the args
Auto Trait Implementations
impl RefUnwindSafe for Config
impl UnwindSafe for Config