Trait egui::widgets::text_edit::TextBuffer
source · pub trait TextBuffer {
Show 19 methods
// Required methods
fn is_mutable(&self) -> bool;
fn as_str(&self) -> &str;
fn insert_text(&mut self, text: &str, char_index: usize) -> usize;
fn delete_char_range(&mut self, char_range: Range<usize>);
// Provided methods
fn char_range(&self, char_range: Range<usize>) -> &str { ... }
fn byte_index_from_char_index(&self, char_index: usize) -> usize { ... }
fn clear(&mut self) { ... }
fn replace_with(&mut self, text: &str) { ... }
fn take(&mut self) -> String { ... }
fn insert_text_at(
&mut self,
ccursor: &mut CCursor,
text_to_insert: &str,
char_limit: usize,
) { ... }
fn decrease_indentation(&mut self, ccursor: &mut CCursor) { ... }
fn delete_selected(&mut self, cursor_range: &CursorRange) -> CCursor { ... }
fn delete_selected_ccursor_range(
&mut self,
[min, max]: [CCursor; 2],
) -> CCursor { ... }
fn delete_previous_char(&mut self, ccursor: CCursor) -> CCursor { ... }
fn delete_next_char(&mut self, ccursor: CCursor) -> CCursor { ... }
fn delete_previous_word(&mut self, max_ccursor: CCursor) -> CCursor { ... }
fn delete_next_word(&mut self, min_ccursor: CCursor) -> CCursor { ... }
fn delete_paragraph_before_cursor(
&mut self,
galley: &Galley,
cursor_range: &CursorRange,
) -> CCursor { ... }
fn delete_paragraph_after_cursor(
&mut self,
galley: &Galley,
cursor_range: &CursorRange,
) -> CCursor { ... }
}
Expand description
Trait constraining what types crate::TextEdit
may use as
an underlying buffer.
Most likely you will use a String
which implements TextBuffer
.
Required Methods§
sourcefn is_mutable(&self) -> bool
fn is_mutable(&self) -> bool
Can this text be edited?
sourcefn insert_text(&mut self, text: &str, char_index: usize) -> usize
fn insert_text(&mut self, text: &str, char_index: usize) -> usize
sourcefn delete_char_range(&mut self, char_range: Range<usize>)
fn delete_char_range(&mut self, char_range: Range<usize>)
Deletes a range of text char_range
from this buffer.
§Notes
char_range
is a character range, not a byte range.
Provided Methods§
sourcefn char_range(&self, char_range: Range<usize>) -> &str
fn char_range(&self, char_range: Range<usize>) -> &str
Reads the given character range.
fn byte_index_from_char_index(&self, char_index: usize) -> usize
sourcefn replace_with(&mut self, text: &str)
fn replace_with(&mut self, text: &str)
Replaces all contents of this string with text
sourcefn take(&mut self) -> String
fn take(&mut self) -> String
Clears all characters in this buffer and returns a string of the contents.
fn insert_text_at( &mut self, ccursor: &mut CCursor, text_to_insert: &str, char_limit: usize, )
fn decrease_indentation(&mut self, ccursor: &mut CCursor)
fn delete_selected(&mut self, cursor_range: &CursorRange) -> CCursor
fn delete_selected_ccursor_range(&mut self, [min, max]: [CCursor; 2]) -> CCursor
fn delete_previous_char(&mut self, ccursor: CCursor) -> CCursor
fn delete_next_char(&mut self, ccursor: CCursor) -> CCursor
fn delete_previous_word(&mut self, max_ccursor: CCursor) -> CCursor
fn delete_next_word(&mut self, min_ccursor: CCursor) -> CCursor
fn delete_paragraph_before_cursor( &mut self, galley: &Galley, cursor_range: &CursorRange, ) -> CCursor
fn delete_paragraph_after_cursor( &mut self, galley: &Galley, cursor_range: &CursorRange, ) -> CCursor
Implementations on Foreign Types§
source§impl TextBuffer for String
impl TextBuffer for String
fn is_mutable(&self) -> bool
fn as_str(&self) -> &str
fn insert_text(&mut self, text: &str, char_index: usize) -> usize
fn delete_char_range(&mut self, char_range: Range<usize>)
fn clear(&mut self)
fn replace_with(&mut self, text: &str)
fn take(&mut self) -> String
source§impl<'a> TextBuffer for &'a str
impl<'a> TextBuffer for &'a str
Immutable view of a &str
!