Function minigrep_test_package_001::search [−][src]
pub fn search<'a>(query: &str, contents: &'a str) -> Vec<&'a str>
Expand description
search through each line in given contents
and return any lines containing a match to the query
Arguments
query
: a query string to search forcontents
: the contents within which we should search for the given query
Examples
use minigrep::search; let query = "duct"; // expect 'duct' in 'productive' let contents = "\ Rust: safe, fast, productive. Pick three."; assert_eq!(vec!["safe, fast, productive."], search(query, contents));