Trait add_ed::ui::UI [−][src]
pub trait UI { fn print(&mut self, data: &str) -> Result<(), &'static str>; fn get_command(
&mut self,
buffer: &dyn Buffer
) -> Result<String, &'static str>; fn get_input(
&mut self,
buffer: &dyn Buffer,
terminator: char
) -> Result<Vec<String>, &'static str>; fn print_selection(
&mut self,
buffer: &dyn Buffer,
selection: (usize, usize),
numbered: bool,
literal: bool
) -> Result<(), &'static str>; }
Expand description
The UI trait used to abstract all common UI operations
Required methods
fn print(&mut self, data: &str) -> Result<(), &'static str>
[src]
fn print(&mut self, data: &str) -> Result<(), &'static str>
[src]A basic print for output of commands
fn get_command(&mut self, buffer: &dyn Buffer) -> Result<String, &'static str>
[src]
fn get_command(&mut self, buffer: &dyn Buffer) -> Result<String, &'static str>
[src]Get a command for parsing and execution
- Buffer passed in to allow for interactive viewing during input, just ignore if not used
- Must return a single line to be parsed, trimming optional
fn get_input(
&mut self,
buffer: &dyn Buffer,
terminator: char
) -> Result<Vec<String>, &'static str>
[src]
fn get_input(
&mut self,
buffer: &dyn Buffer,
terminator: char
) -> Result<Vec<String>, &'static str>
[src]Get input lines until given character is entered alone on a line
- Buffer passed in to allow for interactive viewing during input, just ignore if not used
- Must return a vector newline terminated strings and not return the terminating line
Implementors
impl<'a> UI for DummyUI<'a>
[src]
impl<'a> UI for DummyUI<'a>
[src]fn get_command(&mut self, _buffer: &dyn Buffer) -> Result<String, &'static str>
[src]
fn get_input(
&mut self,
_buffer: &dyn Buffer,
terminator: char
) -> Result<Vec<String>, &'static str>
[src]
&mut self,
_buffer: &dyn Buffer,
terminator: char
) -> Result<Vec<String>, &'static str>
fn print(&mut self, text: &str) -> Result<(), &'static str>
[src]
fn print_selection(
&mut self,
buffer: &dyn Buffer,
selection: (usize, usize),
numbered: bool,
literal: bool
) -> Result<(), &'static str>
[src]
&mut self,
buffer: &dyn Buffer,
selection: (usize, usize),
numbered: bool,
literal: bool
) -> Result<(), &'static str>