Function search

Source
pub fn search<'a>(query: &str, contents: &'a str) -> Vec<&'a str>
Expand description

The search function takes a query string and a string slice and returns a vector of string slices that match the query.

ยงExample

let query = "duct";
let contents = "\
Rust:
safe, fast, productive.
Pick three.
Duct tape.";
assert_eq!(vec!["safe, fast, productive."], daveparr_minigrep::search(query, contents));