Struct copperline::Copperline [] [src]

pub struct Copperline {
    // some fields omitted
}

Methods

impl Copperline

fn new() -> Copperline

Constructs a new Copperline from stdin to stdout.

fn new_from_io<I: AsRawFd, O: AsRawFd>(i: &I, o: &O) -> Copperline

Constructs a new Copperline from the specified resources.

fn new_from_raw_fds(ifd: RawFd, ofd: RawFd) -> Copperline

Constructs a new Copperline from the specified file descriptors.

fn read_line(&mut self, prompt: &str, encoding: Encoding) -> Result<String, Error>

Reads a line from the input using the specified prompt and encoding.

fn read_line_ascii(&mut self, prompt: &str) -> Result<String, Error>

Reads a ASCII encoded line from the input using the specified prompt.

fn read_line_utf8(&mut self, prompt: &str) -> Result<String, Error>

Reads a UTF-8 encoded line from the input using the specified prompt.

fn get_current_history_length(&self) -> usize

Returns the current length of the history.

fn add_history(&mut self, line: String)

Adds a line to the history.

fn get_history_item(&self, idx: usize) -> Option<&String>

Retrieves a line from the history by index.

fn remove_history_item(&mut self, idx: usize) -> Option<String>

Removes an item from the history by index and returns it.

fn clear_history(&mut self)

Clears the current history.

fn clear_screen(&mut self) -> Result<(), Error>

Clears the screen.