Enum project2::search::SearchQuery
source · pub enum SearchQuery {
Text {
search: Arc<AhoCorasick>,
replacement: Option<String>,
whole_word: bool,
case_sensitive: bool,
include_ignored: bool,
inner: SearchInputs,
},
Regex {
regex: Regex,
replacement: Option<String>,
multiline: bool,
whole_word: bool,
case_sensitive: bool,
include_ignored: bool,
inner: SearchInputs,
},
}
Variants§
Implementations§
source§impl SearchQuery
impl SearchQuery
pub fn text( query: impl ToString, whole_word: bool, case_sensitive: bool, include_ignored: bool, files_to_include: Vec<PathMatcher>, files_to_exclude: Vec<PathMatcher> ) -> Result<Self>
pub fn regex( query: impl ToString, whole_word: bool, case_sensitive: bool, include_ignored: bool, files_to_include: Vec<PathMatcher>, files_to_exclude: Vec<PathMatcher> ) -> Result<Self>
pub fn from_proto(message: SearchProject) -> Result<Self>
pub fn with_replacement(self, new_replacement: String) -> Self
pub fn to_proto(&self, project_id: u64) -> SearchProject
pub fn detect<T: Read>(&self, stream: T) -> Result<bool>
sourcepub fn replacement(&self) -> Option<&str>
pub fn replacement(&self) -> Option<&str>
Returns the replacement text for this SearchQuery
.
sourcepub fn replacement_for<'a>(&self, text: &'a str) -> Option<Cow<'a, str>>
pub fn replacement_for<'a>(&self, text: &'a str) -> Option<Cow<'a, str>>
Replaces search hits if replacement is set. text
is assumed to be a string that matches this SearchQuery
exactly, without any leftovers on either side.
pub async fn search( &self, buffer: &BufferSnapshot, subrange: Option<Range<usize>> ) -> Vec<Range<usize>>
pub fn as_str(&self) -> &str
pub fn whole_word(&self) -> bool
pub fn case_sensitive(&self) -> bool
pub fn include_ignored(&self) -> bool
pub fn is_regex(&self) -> bool
pub fn files_to_include(&self) -> &[PathMatcher]
pub fn files_to_exclude(&self) -> &[PathMatcher]
pub fn file_matches(&self, file_path: Option<&Path>) -> bool
pub fn as_inner(&self) -> &SearchInputs
Trait Implementations§
source§impl Clone for SearchQuery
impl Clone for SearchQuery
source§fn clone(&self) -> SearchQuery
fn clone(&self) -> SearchQuery
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl RefUnwindSafe for SearchQuery
impl Send for SearchQuery
impl Sync for SearchQuery
impl Unpin for SearchQuery
impl UnwindSafe for SearchQuery
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