5 let args
: Vec
<String
> = env
::args().collect();
7 let config
= Config
::new(&args
);
9 println
!("Searching for {}", config
.query
);
10 println
!("In file {}", config
.file_path
);
12 let contents
= fs
::read_to_string(config
.file_path
)
13 .expect("Should have been able to read the file");
15 println
!("With text:\n{contents}");
26 fn new(args
: &[String
]) -> Config
{
28 panic
!("not enough arguments");
33 let query
= args
[1].clone();
34 let file_path
= args
[2].clone();
36 Config { query, file_path }