pub struct TextBuffer { /* private fields */ }Expand description
A TextDocument held in memory as a line per String.
What a form gets, and what an application with an ordinary amount of text wants. Undo is a journal of the edits, so it costs what was typed rather than a copy of the text per keystroke; consecutive typing on one line is one entry.
Implementations§
Trait Implementations§
Source§impl Clone for TextBuffer
impl Clone for TextBuffer
Source§fn clone(&self) -> TextBuffer
fn clone(&self) -> TextBuffer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TextBuffer
impl Debug for TextBuffer
Source§impl Default for TextBuffer
impl Default for TextBuffer
Source§impl TextDocument for TextBuffer
impl TextDocument for TextBuffer
Source§fn line_count(&mut self) -> Option<usize>
fn line_count(&mut self) -> Option<usize>
How many lines there are, or
None while that is still being counted. Read moreSource§fn known_lines(&mut self) -> usize
fn known_lines(&mut self) -> usize
Lines the document can hand over now. Equal to
line_count once it
is known, and growing until then.Source§fn line(&mut self, n: usize) -> Option<Cow<'_, str>>
fn line(&mut self, n: usize) -> Option<Cow<'_, str>>
Line
n without its newline, or None if it is not (yet) known.Source§fn delete(&mut self, from: Pos, to: Pos)
fn delete(&mut self, from: Pos, to: Pos)
Deletes
[from, to). from <= to; a range across lines joins them.Source§fn spans(&mut self, n: usize, out: &mut Vec<Span>)
fn spans(&mut self, n: usize, out: &mut Vec<Span>)
The coloured runs of line
n, appended to out in ascending order
without overlaps. Text between runs is drawn in the theme’s content
colour. The default highlights nothing.Source§fn highlights(&mut self, n: usize, line: &str, out: &mut Vec<Range<usize>>)
fn highlights(&mut self, n: usize, line: &str, out: &mut Vec<Range<usize>>)
Byte ranges of line
n to mark behind the text — every match of a
search, say — appended to out in ascending order without overlaps.
line is the line’s text as the widget already has it, so marking
costs no second read. A range out of order, past the end or not on a
character boundary is skipped; the selection is drawn over the marks.
The default marks nothing.Auto Trait Implementations§
impl Freeze for TextBuffer
impl RefUnwindSafe for TextBuffer
impl Send for TextBuffer
impl Sync for TextBuffer
impl Unpin for TextBuffer
impl UnsafeUnpin for TextBuffer
impl UnwindSafe for TextBuffer
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