1 unstable release
0.1.0 | Oct 11, 2022 |
---|
#84 in #mini-grep
6KB
101 lines
This file contains the implementation of the library used in the minigrep console program. The main functions contained in this file are: search used to search for a query string in the file search_case_sensitive use to perform the same search but in case sensitive way.
The following example code shows how to use the package
use std::env;
use std::process;
use minigrep::Config;
use minigrep::mix;
use minigrep::PrimaryColor;
fn main() {
let config = Config::build(env::args()).unwrap_or_else(|err| {
eprintln!("Problem parsing arguments: {err}");
process::exit(1);
});
if let Err(e) = minigrep::run(config) {
eprintln!("Application error: {e}");
process::exit(1);
}
let red = PrimaryColor::Red;
let yellow = PrimaryColor::Yellow;
mix(red, yellow);
}