Skip to main content

FindQuery

Struct FindQuery 

Source
#[non_exhaustive]
pub struct FindQuery { pub text: String, pub case_sensitive: bool, pub whole_word: bool, pub regex: bool, }
Expand description

An active find query: the pattern plus its option flags.

PartialEq so the Document surface can no-op an unchanged query without re-scanning — the flags are part of that identity, because each one changes what matches, not how it is displayed.

The flags pick the matcher: plain text takes the literal byte scan; whole_word or regex take the line-scoped engine.

#[non_exhaustive] so a future option can be added without a breaking change: outside this crate, build one with FindQuery::new (a plain literal query) and set the options you want on its public fields, rather than a struct literal.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§text: String

The text to find — a literal, or a regular expression when regex is set. Empty means “no matches” (never match-all).

§case_sensitive: bool

When false, a/A fold together. Case folding is ASCII-only in the literal matcher, and Unicode-aware in the regex one.

§whole_word: bool

Match only whole words — the ab| option. A match must be bounded by non-word characters (or the edges of its line) on both sides.

§regex: bool

Treat text as a regular expression — the .* option.

Matching is line-scoped: the engine is fed one line at a time, so a pattern can never match across a newline. An invalid pattern is not an error state — it is what every prefix of a pattern being typed looks like — so it simply yields no matches, and FindState::pattern_error carries the reason for the bar to show.

Implementations§

Source§

impl FindQuery

Source

pub fn new(text: impl Into<String>) -> Self

A plain literal query for text — every option off (case-insensitive, not whole-word, not regex). The common case; set the public option fields on the returned value to change it.

Trait Implementations§

Source§

impl Clone for FindQuery

Source§

fn clone(&self) -> FindQuery

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for FindQuery

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for FindQuery

Source§

fn default() -> FindQuery

Returns the “default value” for a type. Read more
Source§

impl Eq for FindQuery

Source§

impl PartialEq for FindQuery

Source§

fn eq(&self, other: &FindQuery) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FindQuery

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.