pub struct RopeBuffer { /* private fields */ }Implementations§
Source§impl RopeBuffer
impl RopeBuffer
pub fn new() -> RopeBuffer
Sourcepub fn get_system_ansi_encoding() -> &'static Encoding
pub fn get_system_ansi_encoding() -> &'static Encoding
根據系統區域設置獲取 ANSI 編碼
pub fn from_file_with_encoding( path: &Path, encoding_config: &EncodingConfig, ) -> Result<RopeBuffer, Error>
pub fn insert_char(&mut self, pos: usize, ch: char)
pub fn insert(&mut self, pos: usize, text: &str)
pub fn delete_char(&mut self, pos: usize)
pub fn delete_range(&mut self, start: usize, end: usize)
pub fn delete_line(&mut self, row: usize)
pub fn line_count(&self) -> usize
pub fn line(&self, idx: usize) -> Option<RopeSlice<'_>>
pub fn line_to_char(&self, line_idx: usize) -> usize
pub fn char_to_line(&self, char_idx: usize) -> usize
pub fn save(&mut self) -> Result<(), Error>
pub fn save_to(&mut self, path: &Path) -> Result<(), Error>
pub fn save_as(&mut self, path: &Path) -> Result<(), Error>
pub fn is_modified(&self) -> bool
pub fn file_path(&self) -> Option<&Path>
pub fn file_name(&self) -> String
pub fn len_chars(&self) -> usize
pub fn get_line_content(&self, line_idx: usize) -> String
Sourcepub fn get_line_full(&self, line_idx: usize) -> String
pub fn get_line_full(&self, line_idx: usize) -> String
獲取完整行內容(包括尾部空格和換行符)
pub fn undo(&mut self) -> Option<usize>
pub fn redo(&mut self) -> Option<usize>
pub fn can_undo(&self) -> bool
pub fn can_redo(&self) -> bool
pub fn set_read_encoding(&mut self, encoding: &'static Encoding)
Sourcepub fn set_save_encoding(&mut self, encoding: &'static Encoding)
pub fn set_save_encoding(&mut self, encoding: &'static Encoding)
設置存檔編碼
pub fn save_encoding(&self) -> &'static Encoding
Sourcepub fn reload_with_encoding(
&mut self,
encoding: &'static Encoding,
) -> Result<(), Error>
pub fn reload_with_encoding( &mut self, encoding: &'static Encoding, ) -> Result<(), Error>
使用指定編碼重新載入檔案
Sourcepub fn change_encoding(&mut self, encoding: &'static Encoding)
pub fn change_encoding(&mut self, encoding: &'static Encoding)
為新建檔案設定編碼(無需重新載入)
Sourcepub fn has_file_path(&self) -> bool
pub fn has_file_path(&self) -> bool
檢查是否有檔案路徑
Trait Implementations§
Source§impl Default for RopeBuffer
impl Default for RopeBuffer
Source§fn default() -> RopeBuffer
fn default() -> RopeBuffer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for RopeBuffer
impl RefUnwindSafe for RopeBuffer
impl Send for RopeBuffer
impl Sync for RopeBuffer
impl Unpin for RopeBuffer
impl UnwindSafe for RopeBuffer
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