pub struct Runner<'a, I, T>where
I: Write,{
pub interface: I,
/* private fields */
}
Expand description
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§
§interface: I
Implementations§
source§impl<'a, I, T> Runner<'a, I, T>where
I: Write,
impl<'a, I, T> Runner<'a, I, T>where
I: Write,
sourcepub fn new(
menu: Menu<'a, I, T>,
buffer: &'a mut [u8],
interface: I,
context: &mut T
) -> Self
pub fn new( menu: Menu<'a, I, T>, buffer: &'a mut [u8], interface: I, context: &mut T ) -> Self
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.
sourcepub fn prompt(&mut self, newline: bool)
pub fn prompt(&mut self, newline: bool)
Print out a new command prompt, including sub-menu names if applicable.
sourcepub fn input_byte(&mut self, input: u8, context: &mut T)
pub fn input_byte(&mut self, input: u8, context: &mut T)
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. By default, an echo feature is enabled to display commands on the terminal.
Auto Trait Implementations§
impl<'a, I, T> Freeze for Runner<'a, I, T>where
I: Freeze,
impl<'a, I, T> RefUnwindSafe for Runner<'a, I, T>where
I: RefUnwindSafe,
impl<'a, I, T> Send for Runner<'a, I, T>where
I: Send,
impl<'a, I, T> Sync for Runner<'a, I, T>where
I: Sync,
impl<'a, I, T> Unpin for Runner<'a, I, T>where
I: Unpin,
impl<'a, I, T> !UnwindSafe for Runner<'a, I, T>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more