[][src]Struct liner::Buffer

pub struct Buffer { /* fields omitted */ }

A buffer for text in the line editor.

It keeps track of each action performed on it for use with undo/redo.

Methods

impl Buffer[src]

pub fn new() -> Self[src]

pub fn clear_actions(&mut self)[src]

pub fn start_undo_group(&mut self)[src]

pub fn end_undo_group(&mut self)[src]

pub fn undo(&mut self) -> bool[src]

pub fn redo(&mut self) -> bool[src]

pub fn revert(&mut self) -> bool[src]

pub fn last_arg(&self) -> Option<&[char]>[src]

pub fn num_chars(&self) -> usize[src]

pub fn num_bytes(&self) -> usize[src]

pub fn char_before(&self, cursor: usize) -> Option<char>[src]

pub fn char_after(&self, cursor: usize) -> Option<char>[src]

pub fn remove(&mut self, start: usize, end: usize) -> usize[src]

Returns the number of characters removed.

pub fn insert(&mut self, start: usize, text: &[char])[src]

pub fn insert_from_buffer(&mut self, other: &Buffer)[src]

pub fn copy_buffer(&mut self, other: &Buffer)[src]

pub fn range(&self, start: usize, end: usize) -> String[src]

pub fn range_chars(&self, start: usize, end: usize) -> Vec<char>[src]

pub fn width(&self) -> Vec<usize>[src]

pub fn range_width(&self, start: usize, end: usize) -> Vec<usize>[src]

pub fn lines(&self) -> Vec<String>[src]

pub fn chars(&self) -> Iter<char>[src]

pub fn truncate(&mut self, num: usize)[src]

pub fn print<W>(&self, out: &mut W) -> Result<()> where
    W: Write
[src]

pub fn as_bytes(&self) -> Vec<u8>[src]

pub fn print_rest<W>(&self, out: &mut W, after: usize) -> Result<usize> where
    W: Write
[src]

Takes other buffer, measures its length and prints this buffer from the point where the other stopped. Used to implement autosuggestions.

pub fn starts_with(&self, other: &Buffer) -> bool[src]

Check if the other buffer starts with the same content as this one. Used to implement autosuggestions.

pub fn contains(&self, pattern: &Buffer) -> bool[src]

Check if the buffer contains pattern. Used to implement history search.

pub fn is_empty(&self) -> bool[src]

Return true if the buffer is empty.

Trait Implementations

impl From<Buffer> for String[src]

impl From<String> for Buffer[src]

impl<'a> From<&'a str> for Buffer[src]

impl Clone for Buffer[src]

impl Default for Buffer[src]

impl Eq for Buffer[src]

impl PartialEq<Buffer> for Buffer[src]

impl Debug for Buffer[src]

impl Display for Buffer[src]

impl FromIterator<char> for Buffer[src]

Auto Trait Implementations

impl Send for Buffer

impl Sync for Buffer

impl Unpin for Buffer

impl UnwindSafe for Buffer

impl RefUnwindSafe for Buffer

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]