diff options
author | Joursoir <chat@joursoir.net> | 2023-03-01 17:59:20 +0400 |
---|---|---|
committer | Joursoir <chat@joursoir.net> | 2023-03-01 17:59:20 +0400 |
commit | 8e40b9ae042b715785004678b1bb3d3a4fca9838 (patch) | |
tree | c63b12a27bbfa771c066efad3ef769f533d918bd /src/lib.rs | |
download | trgrep-8e40b9ae042b715785004678b1bb3d3a4fca9838.tar.gz trgrep-8e40b9ae042b715785004678b1bb3d3a4fca9838.tar.bz2 trgrep-8e40b9ae042b715785004678b1bb3d3a4fca9838.zip |
initial commit
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..c01823d --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,6 @@ +pub fn search<'a>(pattern: &str, contents: &'a str) -> Vec<&'a str> { + contents + .lines() + .filter(|line| line.contains(pattern)) + .collect() +} |