ripgrep_api/search.rs
1use crate::{config::Config, engine, error::SearchError, types::Match};
2
3pub struct Search {
4 inner: std::vec::IntoIter<Match>,
5}
6
7impl Search {
8 pub(crate) fn from_config(config: Config) -> Result<Self, SearchError> {
9 let results = engine::search(&config)?;
10 Ok(Self {
11 inner: results.into_iter(),
12 })
13 }
14}
15
16impl Iterator for Search {
17 type Item = Match;
18
19 fn next(&mut self) -> Option<Self::Item> {
20 self.inner.next()
21 }
22}