2 个不稳定版本
| 0.2.0 | 2019年1月6日 |
|---|---|
| 0.1.0 | 2019年1月6日 |
#194 in #demo
5KB
grrs-lazy
一个简单的搜索工具,基于 rust cli-wg 教程:https://rust-lang-nursery.github.io/cli-wg/tutorial/
与教程中构建的最终 grrs 有一些不同
- 在
src/lib.rs中将find_matches分离出来。 - 使用
std::io::BufReader而不是std::fs::read_to_string,这样我们就可以避免在内存中加载整个文件的内容。 - 在
find_matches中处理迭代器,以便在懒流中完成处理。
安装
要安装,请运行
cargo install grrs-lazy
然后您可以搜索文本文件中的行
$ grrs-lazy Sherlock path/to/the-adventures-of-sherlock-holmes.txt | wc -c
6089
依赖项
~6–14MB
~160K SLoC