[−][src]Struct menu::Runner
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]
T: Write,
pub fn new(
menu: &'a Menu<'a, T>,
buffer: &'a mut [u8],
context: T
) -> Runner<'a, T>
[src]
menu: &'a Menu<'a, T>,
buffer: &'a mut [u8],
context: T
) -> Runner<'a, T>
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,
T: Unpin,
impl<'a, T> Send for Runner<'a, T> where
T: Send,
T: Send,
impl<'a, T> Sync for Runner<'a, T> where
T: Sync,
T: Sync,
Blanket Implementations
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,