[][src]Struct menu::Runner

pub struct Runner<'a, T> where
    T: Write,
    T: 'a, 
{ pub context: T, // some fields omitted }

This structure handles the menu. You feed it bytes as they are read from the console and it executes menu actions when commands are typed in (followed by Enter).

Fields

context: T

The context object the Runner carries around.

Methods

impl<'a, T> Runner<'a, T> where
    T: Write
[src]

pub fn new(
    menu: &'a Menu<'a, T>,
    buffer: &'a mut [u8],
    context: T
) -> Runner<'a, T>
[src]

Create a new Runner. You need to supply a top-level menu, and a buffer that the Runner can use. Feel free to pass anything as the context type - the only requirement is that the Runner can write! to the context, which it will do for all text output.

pub fn prompt(&mut self, newline: bool)[src]

Print out a new command prompt, including sub-menu names if applicable.

pub fn input_byte(&mut self, input: u8)[src]

Add a byte to the menu runner's buffer. If this byte is a carriage-return, the buffer is scanned and the appropriate action performed.

Auto Trait Implementations

impl<'a, T> Unpin for Runner<'a, T> where
    T: Unpin

impl<'a, T> Sync for Runner<'a, T> where
    T: Sync

impl<'a, T> Send for Runner<'a, T> where
    T: Send

Blanket Implementations

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]