Struct gchemol_parser::TextViewer
source · [−]pub struct TextViewer { /* private fields */ }
Expand description
A simple text view for quick peeking part of text
Implementations
sourceimpl TextViewer
impl TextViewer
Constructors
sourceimpl TextViewer
impl TextViewer
Core methods
sourcepub fn current_line_num(&self) -> usize
pub fn current_line_num(&self) -> usize
Get line number at cursor
sourcepub fn current_line(&self) -> &str
pub fn current_line(&self) -> &str
Peek the line at cursor
sourcepub fn goto_line(&mut self, n: usize)
pub fn goto_line(&mut self, n: usize)
Move the cursor to line n
, counting from line 1 at beginning of the text.
sourcepub fn search_forward(&mut self, pattern: &str) -> Result<usize>
pub fn search_forward(&mut self, pattern: &str) -> Result<usize>
Move the cursor to the line matching the pattern. Regex pattern is allowed.
sourcepub fn peek_lines(&self, n: usize, m: usize) -> &str
pub fn peek_lines(&self, n: usize, m: usize) -> &str
Peek the text between line n
and m
(including line m
)
Trait Implementations
sourceimpl Clone for TextViewer
impl Clone for TextViewer
sourcefn clone(&self) -> TextViewer
fn clone(&self) -> TextViewer
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl RefUnwindSafe for TextViewer
impl Send for TextViewer
impl Sync for TextViewer
impl Unpin for TextViewer
impl UnwindSafe for TextViewer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
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.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more