1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/// This will search a query from the contents
///
/// # Example
/// ```
/// use variables::utils::search;
/// let result = search("hello", "hey everyone\nhello world");
/// assert_eq!(result[0], "hello world");
///
/// ```
pub fn search<'a> (query: &str, content: &'a str) -> Vec<&'a str>{
content.lines()
.filter(|l|l.contains(query))
.collect()
}