pub struct TodoFile { /* private fields */ }
Expand description
Represents a rebase file.
Implementations§
Source§impl TodoFile
impl TodoFile
Sourcepub fn new<Path: AsRef<Path>>(
path: Path,
undo_limit: u32,
comment_char: &str,
) -> Self
pub fn new<Path: AsRef<Path>>( path: Path, undo_limit: u32, comment_char: &str, ) -> Self
Create a new instance.
Sourcepub fn write_file(&self) -> Result<(), IoError>
pub fn write_file(&self) -> Result<(), IoError>
Sourcepub fn set_selected_line_index(&mut self, selected_line_index: usize) -> usize
pub fn set_selected_line_index(&mut self, selected_line_index: usize) -> usize
Set the selected line index returning the new index based after ensuring within range.
Sourcepub fn swap_range_up(&mut self, start_index: usize, end_index: usize) -> bool
pub fn swap_range_up(&mut self, start_index: usize, end_index: usize) -> bool
Swap a range of lines up.
Sourcepub fn swap_range_down(&mut self, start_index: usize, end_index: usize) -> bool
pub fn swap_range_down(&mut self, start_index: usize, end_index: usize) -> bool
Swap a range of lines down.
Sourcepub fn remove_lines(&mut self, start_index: usize, end_index: usize)
pub fn remove_lines(&mut self, start_index: usize, end_index: usize)
Remove a range of lines.
Sourcepub fn update_range(
&mut self,
start_index: usize,
end_index: usize,
edit_context: &EditContext,
)
pub fn update_range( &mut self, start_index: usize, end_index: usize, edit_context: &EditContext, )
Update a range of lines.
Sourcepub fn get_selected_line(&self) -> Option<&Line>
pub fn get_selected_line(&self) -> Option<&Line>
Get the selected line.
Sourcepub fn get_max_selected_line_index(&self) -> usize
pub fn get_max_selected_line_index(&self) -> usize
Get the index of the last line that can be selected.
Sourcepub const fn get_selected_line_index(&self) -> usize
pub const fn get_selected_line_index(&self) -> usize
Get the selected line index
Sourcepub fn get_filepath(&self) -> &Path
pub fn get_filepath(&self) -> &Path
Get the file path to the rebase file.
Sourcepub fn get_lines_owned(&self) -> Vec<Line>
pub fn get_lines_owned(&self) -> Vec<Line>
Get an owned copy of the lines.
Sourcepub fn lines_iter(&self) -> Iter<'_, Line>
pub fn lines_iter(&self) -> Iter<'_, Line>
Get an iterator over the lines.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TodoFile
impl RefUnwindSafe for TodoFile
impl Send for TodoFile
impl Sync for TodoFile
impl Unpin for TodoFile
impl UnwindSafe for TodoFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more