pub struct SearchBuilder { /* private fields */ }Expand description
Fluent builder for rg-style search configuration.
use ripgrep_api::SearchBuilder;
let matches: Vec<_> = SearchBuilder::new("todo")
.path(".")
.glob("**/*.rs")
.smart_case()
.build()?
.collect();Implementations§
Source§impl SearchBuilder
impl SearchBuilder
pub fn new(pattern: impl Into<String>) -> Self
pub fn path(self, path: impl AsRef<Path>) -> Self
pub fn paths<I, P>(self, paths: I) -> Self
pub fn build(self) -> Result<Search, SearchError>
pub fn search_with<S: MatchSink>(self, sink: &mut S) -> Result<(), SearchError>
pub fn for_each<F>(self, on_match: F) -> Result<(), SearchError>
pub fn for_each_with_context<F, C>( self, on_match: F, on_context: C, ) -> Result<(), SearchError>
pub fn search_reader<R: Read>( self, reader: R, ) -> Result<Vec<Match>, SearchError>
pub fn search_reader_named<R, P>( self, source: P, reader: R, ) -> Result<Vec<Match>, SearchError>
pub fn search_slice(self, slice: &[u8]) -> Result<Vec<Match>, SearchError>
pub fn search_slice_named<P>( self, source: P, slice: &[u8], ) -> Result<Vec<Match>, SearchError>
pub fn search_reader_with<R, S>( self, reader: R, sink: &mut S, ) -> Result<(), SearchError>
pub fn search_reader_with_named<R, P, S>( self, source: P, reader: R, sink: &mut S, ) -> Result<(), SearchError>
pub fn search_slice_with<S>(
self,
slice: &[u8],
sink: &mut S,
) -> Result<(), SearchError>where
S: MatchSink,
pub fn search_slice_with_named<P, S>( self, source: P, slice: &[u8], sink: &mut S, ) -> Result<(), SearchError>
pub fn glob(self, pattern: impl Into<String>) -> Self
pub fn type_(self, name: impl Into<String>) -> Self
pub fn type_not(self, name: impl Into<String>) -> Self
pub fn type_add(self, name: impl Into<String>, glob: impl Into<String>) -> Self
pub fn types(self, types: Types) -> Self
pub fn overrides(self, overrides: Override) -> Self
pub fn max_depth(self, depth: usize) -> Self
pub fn max_filesize(self, bytes: u64) -> Self
pub fn follow(self) -> Self
pub fn ignore(self, yes: bool) -> Self
pub fn ignore_parent(self, yes: bool) -> Self
pub fn ignore_files(self, yes: bool) -> Self
pub fn ignore_vcs(self, yes: bool) -> Self
pub fn smart_case(self) -> Self
pub fn ignore_case(self) -> Self
pub fn case_sensitive(self) -> Self
pub fn fixed_strings(self) -> Self
pub fn word(self) -> Self
pub fn line_regexp(self) -> Self
pub fn before_context(self, lines: usize) -> Self
pub fn after_context(self, lines: usize) -> Self
pub fn context(self, lines: usize) -> Self
pub fn max_count(self, count: usize) -> Self
pub fn binary_detection(self, yes: bool) -> Self
pub fn threads(self, threads: usize) -> Self
pub fn memory_map(self, choice: MmapChoice) -> Self
pub fn heap_limit(self, bytes: usize) -> Self
pub fn no_heap_limit(self) -> Self
pub fn engine_default(self) -> Self
pub fn count(self) -> Result<u64, SearchError>
pub fn files_with_matches(self) -> Result<Vec<PathBuf>, SearchError>
Auto Trait Implementations§
impl Freeze for SearchBuilder
impl RefUnwindSafe for SearchBuilder
impl Send for SearchBuilder
impl Sync for SearchBuilder
impl Unpin for SearchBuilder
impl UnsafeUnpin for SearchBuilder
impl UnwindSafe for SearchBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more