pub struct VecBuffer { /* private fields */ }Expand description
VecBuffer, the default Buffer implementation
It is based on storing the text in a Vector of lines. Regex functionality is imported from the Regex crate.
Implementations
Trait Implementations
sourceimpl Buffer for VecBuffer
impl Buffer for VecBuffer
sourcefn get_tag(&self, tag: char) -> Result<usize, &'static str>
fn get_tag(&self, tag: char) -> Result<usize, &'static str>
Get line tagged with given letter. Not found is error
sourcefn get_matching(
&self,
pattern: &str,
curr_line: usize,
backwards: bool
) -> Result<usize, &'static str>
fn get_matching(
&self,
pattern: &str,
curr_line: usize,
backwards: bool
) -> Result<usize, &'static str>
Return the nearest previous/following index in the selection that contains the regex pattern
sourcefn mark_matching(
&mut self,
pattern: &str,
selection: (usize, usize),
inverse: bool
) -> Result<(), &'static str>
fn mark_matching(
&mut self,
pattern: &str,
selection: (usize, usize),
inverse: bool
) -> Result<(), &'static str>
Set the matched flag on all lines matching given pattern
sourcefn get_marked(&mut self) -> Result<Option<usize>, &'static str>
fn get_marked(&mut self) -> Result<Option<usize>, &'static str>
Get a line with the matched flag set, clearing that line’s flag
sourcefn tag_line(&mut self, index: usize, tag: char) -> Result<(), &'static str>
fn tag_line(&mut self, index: usize, tag: char) -> Result<(), &'static str>
Mark a line with a letter, mark with ‘\0’ to clear
sourcefn insert<'a>(
&mut self,
data: &mut dyn Iterator<Item = &'a str>,
index: usize
) -> Result<(), &'static str>
fn insert<'a>(
&mut self,
data: &mut dyn Iterator<Item = &'a str>,
index: usize
) -> Result<(), &'static str>
Takes a iterator over lines in strings and inserts after given index
sourcefn cut(&mut self, selection: (usize, usize)) -> Result<(), &'static str>
fn cut(&mut self, selection: (usize, usize)) -> Result<(), &'static str>
Cut the selection from the buffer, into the clipboard
sourcefn change<'a>(
&mut self,
data: &mut dyn Iterator<Item = &'a str>,
selection: (usize, usize)
) -> Result<(), &'static str>
fn change<'a>(
&mut self,
data: &mut dyn Iterator<Item = &'a str>,
selection: (usize, usize)
) -> Result<(), &'static str>
Replace selection with input
sourcefn mov(
&mut self,
selection: (usize, usize),
index: usize
) -> Result<(), &'static str>
fn mov(
&mut self,
selection: (usize, usize),
index: usize
) -> Result<(), &'static str>
Move selection to immediately after index
sourcefn mov_copy(
&mut self,
selection: (usize, usize),
index: usize
) -> Result<(), &'static str>
fn mov_copy(
&mut self,
selection: (usize, usize),
index: usize
) -> Result<(), &'static str>
Insert a copy of the selection immediately after index
sourcefn join(&mut self, selection: (usize, usize)) -> Result<(), &'static str>
fn join(&mut self, selection: (usize, usize)) -> Result<(), &'static str>
Join all lines in selection into one line
sourcefn copy(&mut self, selection: (usize, usize)) -> Result<(), &'static str>
fn copy(&mut self, selection: (usize, usize)) -> Result<(), &'static str>
Copy selected lines into clipboard
sourcefn paste(&mut self, index: usize) -> Result<usize, &'static str>
fn paste(&mut self, index: usize) -> Result<usize, &'static str>
Paste the clipboard contents after given index Leave clipboard unchanged Read more
sourcefn search_replace(
&mut self,
pattern: (&str, &str),
selection: (usize, usize),
global: bool
) -> Result<usize, &'static str>
fn search_replace(
&mut self,
pattern: (&str, &str),
selection: (usize, usize),
global: bool
) -> Result<usize, &'static str>
Perform regex search and replace on the selection changing pattern.0 to pattern.1 Should interpret escape sequences in both patterns. At minimum \n and \. If pattern is empty, should re-use stored pattern from previous s command Returns new end of selection, since it may delete or add lines Beware that it may delete the whole selection just as ‘c’ Read more
sourcefn read_from(
&mut self,
path: &str,
index: Option<usize>,
must_exist: bool
) -> Result<usize, &'static str>
fn read_from(
&mut self,
path: &str,
index: Option<usize>,
must_exist: bool
) -> Result<usize, &'static str>
Read to the buffer from given path If index is None replaces current buffer with read lines Else inserts read lines after given index Return number of lines read Read more
impl Eq for VecBuffer
impl StructuralEq for VecBuffer
impl StructuralPartialEq for VecBuffer
Auto Trait Implementations
impl RefUnwindSafe for VecBuffer
impl Send for VecBuffer
impl Sync for VecBuffer
impl Unpin for VecBuffer
impl UnwindSafe for VecBuffer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more