pub struct FindState {
pub query: String,
pub replacement: String,
pub options: FindOptions,
pub matches: Vec<FindResult>,
pub current_index: usize,
pub is_visible: bool,
pub is_replace_mode: bool,
}Available on crate features
editor and find-replace only.Expand description
State for find/replace operations.
Fields§
§query: StringCurrent search query
replacement: StringReplacement text
options: FindOptionsFind options
matches: Vec<FindResult>All matches in the current document
current_index: usizeIndex of the currently selected match
is_visible: boolWhether the find panel is visible
is_replace_mode: boolWhether replace mode is active
Implementations§
Source§impl FindState
impl FindState
Sourcepub fn next(&mut self) -> Option<FindResult>
pub fn next(&mut self) -> Option<FindResult>
Navigate to the next match.
Returns the new current match if any.
Sourcepub fn prev(&mut self) -> Option<FindResult>
pub fn prev(&mut self) -> Option<FindResult>
Navigate to the previous match.
Returns the new current match if any.
Sourcepub fn current_match(&self) -> Option<FindResult>
pub fn current_match(&self) -> Option<FindResult>
Get the current match.
Sourcepub fn match_count(&self) -> usize
pub fn match_count(&self) -> usize
Get the match count.
Sourcepub fn has_matches(&self) -> bool
pub fn has_matches(&self) -> bool
Check if there are any matches.
Sourcepub fn replace_current(&self, text: &str) -> Option<String>
pub fn replace_current(&self, text: &str) -> Option<String>
Replace the current match.
Returns the new text if replacement was made.
Sourcepub fn replace_all(&self, text: &str) -> String
pub fn replace_all(&self, text: &str) -> String
Replace all matches.
Returns the new text with all replacements made.
Sourcepub fn show_replace(&mut self)
pub fn show_replace(&mut self)
Show the find and replace panel.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FindState
impl RefUnwindSafe for FindState
impl Send for FindState
impl Sync for FindState
impl Unpin for FindState
impl UnwindSafe for FindState
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,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> SerializableKey for T
impl<T> SerializableKey for T
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.