Struct add_ed::ui::ScriptedUI
source · pub struct ScriptedUI<'a> {
pub input: VecDeque<String>,
pub print_ui: Option<&'a mut dyn UI>,
}
Expand description
This is a scripted UI. It returns the scripted input without querying user.
How to use:
- Put the input to simulate line-by-line in the input variable. (terminating ‘\n’ required, errors may arize if missing)
- If you want output from print commands put a UI to print with in
print_ui
. (If none given prints will be quietly ignored)
Fields§
§input: VecDeque<String>
§print_ui: Option<&'a mut dyn UI>
Trait Implementations§
source§impl<'a> UI for ScriptedUI<'a>
impl<'a> UI for ScriptedUI<'a>
source§fn get_command(&mut self, _ed: &Ed<'_>, _prefix: Option<char>) -> Result<String>
fn get_command(&mut self, _ed: &Ed<'_>, _prefix: Option<char>) -> Result<String>
Get a command for parsing and execution Read more
source§fn get_input(&mut self, _ed: &Ed<'_>, terminator: char) -> Result<Vec<String>>
fn get_input(&mut self, _ed: &Ed<'_>, terminator: char) -> Result<Vec<String>>
Get input lines until given character is entered alone on a line Read more
source§fn print_message(&mut self, text: &str) -> Result<()>
fn print_message(&mut self, text: &str) -> Result<()>
A basic print for errors and other information messages
source§fn print_commands(&mut self) -> Result<()>
fn print_commands(&mut self) -> Result<()>
Print a listing of the commands with short descriptions Read more
source§fn print_command_documentation(&mut self) -> Result<()>
fn print_command_documentation(&mut self) -> Result<()>
Print commands documentation Read more
source§fn print_selection(
&mut self,
ed: &Ed<'_>,
selection: (usize, usize),
numbered: bool,
literal: bool
) -> Result<()>
fn print_selection( &mut self, ed: &Ed<'_>, selection: (usize, usize), numbered: bool, literal: bool ) -> Result<()>
Print the given selection with the given options Read more
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ScriptedUI<'a>
impl<'a> !Send for ScriptedUI<'a>
impl<'a> !Sync for ScriptedUI<'a>
impl<'a> Unpin for ScriptedUI<'a>
impl<'a> !UnwindSafe for ScriptedUI<'a>
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