pub trait Select {
// Required methods
fn search_content(&self) -> &str;
fn render_before_content(&self) -> Option<impl Display + '_>;
fn render_after_content(&self) -> Option<impl Display + '_>;
}
Expand description
An item that can be selected in a fuzzy select prompt.
This trait is implemented for a number of string like types, where the rendered and searched content is identical to the string.
For more complex items, trait implementation need to provide what content is being searched and how the item is rendered.
The search content will always be rendered and possibly highlighted with the matched parts of the search query. One can optionally render additional content before and after the search content. This will only be included in the rendering, not in the search.
Required Methods§
Sourcefn search_content(&self) -> &str
fn search_content(&self) -> &str
The content that is being used to match against the prompt input.
Sourcefn render_before_content(&self) -> Option<impl Display + '_>
fn render_before_content(&self) -> Option<impl Display + '_>
Optionally render additional content before the search content when showing this item.
Sourcefn render_after_content(&self) -> Option<impl Display + '_>
fn render_after_content(&self) -> Option<impl Display + '_>
Optionally render additional content after the search content when showing this item.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.