pub struct SearchQuery {
pub text: String,
pub case_sensitive: bool,
pub whole_word: bool,
}Expand description
Query used by the code editor search engine.
Matching is case-insensitive and substring-based by default. Case folding and whole-word boundaries intentionally use ASCII semantics.
§Examples
use ailloli_ui_editor::SearchQuery;
let query = SearchQuery::new("name").case_sensitive(true).whole_word(true);
assert_eq!(query.text, "name");
assert!(query.case_sensitive && query.whole_word);Fields§
§text: StringSearch needle; an empty string matches nothing.
case_sensitive: boolWhether ASCII letter case must match exactly.
whole_word: boolWhether adjacent ASCII letters, digits, or underscores reject a match.
Implementations§
Source§impl SearchQuery
Builds search queries.
impl SearchQuery
Builds search queries.
Sourcepub fn new(text: impl Into<String>) -> Self
pub fn new(text: impl Into<String>) -> Self
Creates a case-insensitive substring query.
§Examples
use ailloli_ui_editor::SearchQuery;
let query = SearchQuery::new("TODO");
assert!(!query.case_sensitive);
assert!(!query.whole_word);Sourcepub fn case_sensitive(self, case_sensitive: bool) -> Self
pub fn case_sensitive(self, case_sensitive: bool) -> Self
Sets exact ASCII case matching and returns the query.
§Examples
use ailloli_ui_editor::SearchQuery;
assert!(SearchQuery::new("x").case_sensitive(true).case_sensitive);Sourcepub fn whole_word(self, whole_word: bool) -> Self
pub fn whole_word(self, whole_word: bool) -> Self
Sets ASCII whole-word filtering and returns the query.
§Examples
use ailloli_ui_editor::SearchQuery;
assert!(SearchQuery::new("let").whole_word(true).whole_word);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 moreSource§impl Debug for SearchQuery
impl Debug for SearchQuery
Source§impl Hash for SearchQuery
impl Hash for SearchQuery
Source§impl PartialEq for SearchQuery
impl PartialEq for SearchQuery
impl Eq for SearchQuery
impl StructuralPartialEq for SearchQuery
Auto Trait Implementations§
impl Freeze for SearchQuery
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.