Struct rustyline_async::Readline
source · pub struct Readline { /* private fields */ }
Expand description
Structure that contains all the data necessary to read and write lines in an asyncronous manner
Implementations§
source§impl Readline
impl Readline
sourcepub fn new(prompt: String) -> Result<(Self, SharedWriter), ReadlineError>
pub fn new(prompt: String) -> Result<(Self, SharedWriter), ReadlineError>
Create new Readline
sourcepub fn set_max_history(&mut self, max_size: usize)
pub fn set_max_history(&mut self, max_size: usize)
Set max history length
sourcepub fn should_print_line_on(&mut self, enter: bool, control_c: bool)
pub fn should_print_line_on(&mut self, enter: bool, control_c: bool)
Set whether the input line should remain on the screen after events.
If enter
is true, then when the user presses “Enter”, the prompt
and the text they entered will remain on the screen, and the cursor
will move to the next line. If enter
is false, the prompt &
input will be erased instead.
control_c
similarly controls the behavior for when the user
presses Ctrl-C.
The default value for both settings is true
.
sourcepub fn flush(&mut self) -> Result<(), ReadlineError>
pub fn flush(&mut self) -> Result<(), ReadlineError>
Flush all writers to terminal
sourcepub async fn readline(&mut self) -> Result<String, ReadlineError>
pub async fn readline(&mut self) -> Result<String, ReadlineError>
Polling function for readline, manages all input and output.
sourcepub fn add_history_entry(&mut self, entry: String) -> Option<()>
pub fn add_history_entry(&mut self, entry: String) -> Option<()>
Add history entry asyncronously
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Readline
impl Send for Readline
impl Sync for Readline
impl Unpin for Readline
impl !UnwindSafe for Readline
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