dgrep

Function search

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

1

§Example

it’s a demo for veritifying the behavior of the search function.

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