Trait Select

Source
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§

Source

fn search_content(&self) -> &str

The content that is being used to match against the prompt input.

Source

fn render_before_content(&self) -> Option<impl Display + '_>

Optionally render additional content before the search content when showing this item.

Source

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.

Implementations on Foreign Types§

Source§

impl Select for &str

Source§

impl Select for Cow<'_, str>

Source§

impl Select for Box<str>

Source§

impl Select for Rc<str>

Source§

impl Select for String

Source§

impl Select for Arc<str>

Implementors§