MultiOptionPrompt

Trait MultiOptionPrompt 

Source
pub trait MultiOptionPrompt<T> {
    // Required methods
    fn max_options_count(&self) -> u16;
    fn options(&self) -> &Options<T>;
    fn currently_selected_index(&self) -> usize;
    fn draw_option(
        &self,
        option_index: usize,
        option_label: &str,
        is_selected: bool,
        cmd_buffer: &mut impl CommandBuffer,
    );
    fn draw_header(
        &self,
        cmd_buffer: &mut impl CommandBuffer,
        is_submitted: bool,
    );

    // Provided method
    fn draw_multioption(
        &self,
        label: &str,
        is_submitted: bool,
        label_style: &LabelStyle,
        cmd_buffer: &mut impl CommandBuffer,
    ) { ... }
}
Expand description

Helper trait that simplifies the implementation of the prompts that have multiple options to choose from. It handles filtering, pagination, drawing prompt header and options.

Required Methods§

Source

fn max_options_count(&self) -> u16

Maximum number of options that can be displayed on the screen

Source

fn options(&self) -> &Options<T>

Returns the reference to the Options struct

Source

fn currently_selected_index(&self) -> usize

Get the index of the option on the screen that is currently selected

Source

fn draw_option( &self, option_index: usize, option_label: &str, is_selected: bool, cmd_buffer: &mut impl CommandBuffer, )

Draws the option with the given index and label

Source

fn draw_header(&self, cmd_buffer: &mut impl CommandBuffer, is_submitted: bool)

Draws the prompt header

Provided Methods§

Source

fn draw_multioption( &self, label: &str, is_submitted: bool, label_style: &LabelStyle, cmd_buffer: &mut impl CommandBuffer, )

Draws the entire prompt with all the options. Call this from within the Prompt::draw() method

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.

Implementors§