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

source

pub fn new(prompt: String) -> Result<(Self, SharedWriter), ReadlineError>

Create new Readline

source

pub fn set_max_history(&mut self, max_size: usize)

Set max history length

source

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.

source

pub fn flush(&mut self) -> Result<(), ReadlineError>

Flush all writers to terminal

source

pub async fn readline(&mut self) -> Result<String, ReadlineError>

Polling function for readline, manages all input and output.

source

pub fn add_history_entry(&mut self, entry: String) -> Option<()>

Add history entry asyncronously

Trait Implementations§

source§

impl Drop for Readline

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.