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§

§

Text

Fields

§search: Arc<AhoCorasick>
§replacement: Option<String>
§whole_word: bool
§case_sensitive: bool
§include_ignored: bool
§

Regex

Fields

§regex: Regex
§replacement: Option<String>
§multiline: bool
§whole_word: bool
§case_sensitive: bool
§include_ignored: bool

Implementations§

source§

impl SearchQuery

source

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>

source

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>

source

pub fn from_proto(message: SearchProject) -> Result<Self>

source

pub fn with_replacement(self, new_replacement: String) -> Self

source

pub fn to_proto(&self, project_id: u64) -> SearchProject

source

pub fn detect<T: Read>(&self, stream: T) -> Result<bool>

source

pub fn replacement(&self) -> Option<&str>

Returns the replacement text for this SearchQuery.

source

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.

source

pub async fn search( &self, buffer: &BufferSnapshot, subrange: Option<Range<usize>> ) -> Vec<Range<usize>>

source

pub fn as_str(&self) -> &str

source

pub fn whole_word(&self) -> bool

source

pub fn case_sensitive(&self) -> bool

source

pub fn include_ignored(&self) -> bool

source

pub fn is_regex(&self) -> bool

source

pub fn files_to_include(&self) -> &[PathMatcher]

source

pub fn files_to_exclude(&self) -> &[PathMatcher]

source

pub fn file_matches(&self, file_path: Option<&Path>) -> bool

source

pub fn as_inner(&self) -> &SearchInputs

Trait Implementations§

source§

impl Clone for SearchQuery

source§

fn clone(&self) -> SearchQuery

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for SearchQuery

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for Twhere T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more