Skip to main content

RootMenu

Struct RootMenu 

Source
pub struct RootMenu { /* private fields */ }
Expand description

Top-level configuration menu (the first real Dialog impl).

Owns a fixed list of seven entries, an integer cursor, a snapshot of the current SerialConfig / LineEndingConfig (passed on to sub-dialogs), and a rendering style. Emits DialogOutcome::Push for every non-exit selection and DialogOutcome::Close for Esc / “Exit menu”.

Implementations§

Source§

impl RootMenu

Source

pub const fn new( initial_config: SerialConfig, initial_line_endings: LineEndingConfig, initial_modem: ModemLineSnapshot, initial_modal_style: ModalStyle, cli_overrides: Vec<&'static str>, ) -> Self

Construct a root menu with the cursor on the first item and snapshotting initial_config, initial_line_endings, initial_modem, initial_modal_style, and cli_overrides for forwarding to sub-dialogs (SerialPortSetupDialog, LineEndingsDialog, ModemControlDialog, and ScreenOptionsDialog).

cli_overrides carries short flag labels (-b, -d, …) for every CLI argument that overrode a profile value at startup. Pass Vec::new() when no flags override anything; the SerialPortSetupDialog skips its hint line in that case.

Source

pub const fn selected(&self) -> usize

Current cursor position (0-based).

Source

pub const fn items(&self) -> &'static [&'static str]

Items in display order.

Trait Implementations§

Source§

impl Dialog for RootMenu

Source§

fn title(&self) -> &str

Human-readable title, used for decoration.
Source§

fn render(&self, area: Rect, buf: &mut Buffer)

Render the dialog into the given area.
Source§

fn handle_key(&mut self, key: KeyEvent) -> DialogOutcome

Handle a key event and report back how the stack should react.
Source§

fn preferred_size(&self, outer: Rect) -> Rect

Preferred size of the dialog when rendered inside outer. Read more

Auto Trait Implementations§

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more