[][src]Trait druid::text::EditableText

pub trait EditableText: Sized {
    pub fn cursor(&self, position: usize) -> Option<StringCursor<'_>>;
pub fn edit(&mut self, range: Range<usize>, new: impl Into<String>);
pub fn slice(&self, range: Range<usize>) -> Option<Cow<'_, str>>;
pub fn len(&self) -> usize;
pub fn prev_word_offset(&self, offset: usize) -> Option<usize>;
pub fn next_word_offset(&self, offset: usize) -> Option<usize>;
pub fn prev_grapheme_offset(&self, offset: usize) -> Option<usize>;
pub fn next_grapheme_offset(&self, offset: usize) -> Option<usize>;
pub fn prev_codepoint_offset(&self, offset: usize) -> Option<usize>;
pub fn next_codepoint_offset(&self, offset: usize) -> Option<usize>;
pub fn preceding_line_break(&self, offset: usize) -> usize;
pub fn next_line_break(&self, offset: usize) -> usize;
pub fn is_empty(&self) -> bool;
pub fn from_str(s: &str) -> Self; }

An EditableText trait.

Required methods

pub fn cursor(&self, position: usize) -> Option<StringCursor<'_>>[src]

Create a cursor with a reference to the text and a offset position.

Returns None if the position isn't a codepoint boundary.

pub fn edit(&mut self, range: Range<usize>, new: impl Into<String>)[src]

Replace range with new text. Can panic if supplied an invalid range.

pub fn slice(&self, range: Range<usize>) -> Option<Cow<'_, str>>[src]

Get slice of text at range.

pub fn len(&self) -> usize[src]

Get length of text (in bytes).

pub fn prev_word_offset(&self, offset: usize) -> Option<usize>[src]

Get the previous word offset from the given offset, if it exists.

pub fn next_word_offset(&self, offset: usize) -> Option<usize>[src]

Get the next word offset from the given offset, if it exists.

pub fn prev_grapheme_offset(&self, offset: usize) -> Option<usize>[src]

Get the next grapheme offset from the given offset, if it exists.

pub fn next_grapheme_offset(&self, offset: usize) -> Option<usize>[src]

Get the next grapheme offset from the given offset, if it exists.

pub fn prev_codepoint_offset(&self, offset: usize) -> Option<usize>[src]

Get the previous codepoint offset from the given offset, if it exists.

pub fn next_codepoint_offset(&self, offset: usize) -> Option<usize>[src]

Get the next codepoint offset from the given offset, if it exists.

pub fn preceding_line_break(&self, offset: usize) -> usize[src]

Get the preceding line break offset from the given offset

pub fn next_line_break(&self, offset: usize) -> usize[src]

Get the next line break offset from the given offset

pub fn is_empty(&self) -> bool[src]

Returns true if this text has 0 length.

pub fn from_str(s: &str) -> Self[src]

Construct an instance of this type from a &str.

Loading content...

Implementations on Foreign Types

impl EditableText for String[src]

impl EditableText for Arc<String>[src]

Loading content...

Implementors

Loading content...