Trait Findable
pub trait Findable {
// Required methods
fn find(&mut self, query: &str, options: FindOptions) -> Vec<FindMatch>;
fn reveal(&mut self, index: usize);
// Provided methods
fn clear_find(&mut self) { ... }
fn supports_replace(&self) -> bool { ... }
fn replace(&mut self, _index: usize, _with: &str) -> bool { ... }
fn replace_all(&mut self, _with: &str) -> usize { ... }
fn supports_hex(&self) -> bool { ... }
fn supports_regex(&self) -> bool { ... }
fn step(&mut self, _forward: bool) -> bool { ... }
fn content_revision(&self) -> u64 { ... }
}Expand description
A view whose content can be searched in place.
Required Methods§
fn find(&mut self, query: &str, options: FindOptions) -> Vec<FindMatch>
fn find(&mut self, query: &str, options: FindOptions) -> Vec<FindMatch>
Every match of query under options, in reading order, and keep
them to paint. An empty query clears the matches.
fn reveal(&mut self, index: usize)
fn reveal(&mut self, index: usize)
Make match index the current one: scroll it into view and paint it
emphasised (see paint_find_match).
Provided Methods§
fn clear_find(&mut self)
fn clear_find(&mut self)
The bar closed: stop painting matches.
fn supports_replace(&self) -> bool
fn supports_replace(&self) -> bool
Whether this view can replace text; the bar then offers a replace row.
fn replace(&mut self, _index: usize, _with: &str) -> bool
fn replace(&mut self, _index: usize, _with: &str) -> bool
Replace match index with with. Returns whether it changed the
content; an edit goes through the view’s own actions, so it is undoable.
fn replace_all(&mut self, _with: &str) -> usize
fn replace_all(&mut self, _with: &str) -> usize
Replace every match; returns how many changed.
fn supports_hex(&self) -> bool
fn supports_hex(&self) -> bool
Whether this view shows bytes, so the bar offers a text/hex mode.
fn supports_regex(&self) -> bool
fn supports_regex(&self) -> bool
Whether this view can match a regular expression, so the bar offers
the toggle for it (FindMode::Regex).
fn step(&mut self, _forward: bool) -> bool
fn step(&mut self, _forward: bool) -> bool
Step to the next (or previous) match in a view whose engine owns the
matches (a web page). Return true when the view stepped itself; it
then reports the new position with FindBar::set_results. The
default false lets the bar step through the matches find
returned.
fn content_revision(&self) -> u64
fn content_revision(&self) -> u64
A number that changes whenever the content under the bar changes (an
edit, a page’s text arriving). The bar finds again on its next
FindBar::drive when it moved, keeping the current match, so the
counter never lags the content. The default never changes; such a view
calls FindBar::refresh itself.