lib.rs (ripgrep-12.1.1) | : | lib.rs (ripgrep-13.0.0) | ||
---|---|---|---|---|
skipping to change at line 51 | skipping to change at line 51 | |||
sub-module for easy searching with closures. | sub-module for easy searching with closures. | |||
# Example | # Example | |||
This example shows how to execute the searcher and read the search results | This example shows how to execute the searcher and read the search results | |||
using the | using the | |||
[`UTF8`](sinks/struct.UTF8.html) | [`UTF8`](sinks/struct.UTF8.html) | |||
implementation of `Sink`. | implementation of `Sink`. | |||
``` | ``` | |||
extern crate grep_matcher; | ||||
extern crate grep_regex; | ||||
extern crate grep_searcher; | ||||
use std::error::Error; | use std::error::Error; | |||
use grep_matcher::Matcher; | use grep_matcher::Matcher; | |||
use grep_regex::RegexMatcher; | use grep_regex::RegexMatcher; | |||
use grep_searcher::Searcher; | use grep_searcher::Searcher; | |||
use grep_searcher::sinks::UTF8; | use grep_searcher::sinks::UTF8; | |||
const SHERLOCK: &'static [u8] = b"\ | const SHERLOCK: &'static [u8] = b"\ | |||
For the Doctor Watsons of this world, as opposed to the Sherlock | For the Doctor Watsons of this world, as opposed to the Sherlock | |||
Holmeses, success in the province of detective work must always | Holmeses, success in the province of detective work must always | |||
skipping to change at line 102 | skipping to change at line 98 | |||
} | } | |||
``` | ``` | |||
See also `examples/search-stdin.rs` from the root of this crate's directory | See also `examples/search-stdin.rs` from the root of this crate's directory | |||
to see a similar example that accepts a pattern on the command line and | to see a similar example that accepts a pattern on the command line and | |||
searches stdin. | searches stdin. | |||
*/ | */ | |||
#![deny(missing_docs)] | #![deny(missing_docs)] | |||
extern crate bstr; | pub use crate::lines::{LineIter, LineStep}; | |||
extern crate bytecount; | pub use crate::searcher::{ | |||
extern crate encoding_rs; | ||||
extern crate encoding_rs_io; | ||||
extern crate grep_matcher; | ||||
#[macro_use] | ||||
extern crate log; | ||||
extern crate memmap; | ||||
#[cfg(test)] | ||||
extern crate regex; | ||||
pub use lines::{LineIter, LineStep}; | ||||
pub use searcher::{ | ||||
BinaryDetection, ConfigError, Encoding, MmapChoice, Searcher, | BinaryDetection, ConfigError, Encoding, MmapChoice, Searcher, | |||
SearcherBuilder, | SearcherBuilder, | |||
}; | }; | |||
pub use sink::sinks; | pub use crate::sink::sinks; | |||
pub use sink::{ | pub use crate::sink::{ | |||
Sink, SinkContext, SinkContextKind, SinkError, SinkFinish, SinkMatch, | Sink, SinkContext, SinkContextKind, SinkError, SinkFinish, SinkMatch, | |||
}; | }; | |||
#[macro_use] | #[macro_use] | |||
mod macros; | mod macros; | |||
mod line_buffer; | mod line_buffer; | |||
mod lines; | mod lines; | |||
mod searcher; | mod searcher; | |||
mod sink; | mod sink; | |||
End of changes. 3 change blocks. | ||||
19 lines changed or deleted | 4 lines changed or added |