Struct console_menu::MenuProps

source ·
pub struct MenuProps<'a> {
    pub title: &'a str,
    pub message: &'a str,
    pub bg_color: u8,
    pub fg_color: u8,
    pub msg_color: u8,
    pub exit_on_action: bool,
}
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.

§bg_color: u8§fg_color: u8§msg_color: u8§exit_on_action: bool

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

Trait Implementations§

source§

impl Default for MenuProps<'_>

MenuProps {
    title: "",
    message: "",
    bg_color: 8,
    fg_color: 15,
    msg_color: 7,
    exit_on_action: true,
}
source§

fn default() -> MenuProps<'static>

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

Auto Trait Implementations§

§

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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.