Struct MenuProps

Source
pub struct MenuProps<'a> {
    pub title: &'a str,
    pub message: &'a str,
    pub exit_on_action: bool,
    pub bg_color: u8,
    pub fg_color: u8,
    pub title_color: Option<u8>,
    pub selected_color: Option<u8>,
    pub msg_color: Option<u8>,
}
Expand description

Stores configuration data passed to a Menu on creation.

Menus use 8-bit colors to ensure widespread terminal support. It should be noted that values from 0-15 will make colors vary based on individual terminal settings.

Configure a subset of properties using the defaults and struct update syntax:

let props = MenuProps {
    title: "My Menu",
    ..MenuProps::default()
};

Fields§

§title: &'a str

Displays above the list of menu options. Pass an empty string for no title.

§message: &'a str

Display below the list of menu options. Pass an empty string for no message.

§exit_on_action: bool

If true, menu will exit immediately upon an option being selected.

§bg_color: u8

The background color for the menu.

§fg_color: u8

The foreground (text) color for the menu.

§title_color: Option<u8>

Optional color for the title. If None, the foreground color will be used.

§selected_color: Option<u8>

Optional color for the selected menu option. If None, the foreground color will be used.

§msg_color: Option<u8>

Optional color for the footer message. If None, the foreground color will be used.

Trait Implementations§

Source§

impl Default for MenuProps<'_>

MenuProps {
    title: "",
    message: "",
    exit_on_action: true,
    bg_color: 8,
    fg_color: 15,
    title_color: None,
    selected_color: None,
    msg_color: Some(7),
}
Source§

fn default() -> MenuProps<'static>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for MenuProps<'a>

§

impl<'a> RefUnwindSafe for MenuProps<'a>

§

impl<'a> Send for MenuProps<'a>

§

impl<'a> Sync for MenuProps<'a>

§

impl<'a> Unpin for MenuProps<'a>

§

impl<'a> UnwindSafe for MenuProps<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.