dioxus_native_core::utils::cursor

Trait Text

Source
pub trait Text {
    // Required methods
    fn line(&self, number: usize) -> Option<&Self>;
    fn length(&self) -> usize;
    fn line_count(&self) -> usize;
    fn character(&self, idx: usize) -> Option<char>;
    fn len_before_line(&self, line: usize) -> usize;
}
Expand description

This contains the information about the text that is used by the cursor to handle navigation.

Required Methods§

Source

fn line(&self, number: usize) -> Option<&Self>

Returns the line at the given index.

Source

fn length(&self) -> usize

Returns the length of the text in characters.

Source

fn line_count(&self) -> usize

Returns the number of lines in the text.

Source

fn character(&self, idx: usize) -> Option<char>

Returns the character at the given character index.

Source

fn len_before_line(&self, line: usize) -> usize

Returns the length of the text before the given line in characters.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Text for str

Source§

fn line(&self, number: usize) -> Option<&str>

Source§

fn length(&self) -> usize

Source§

fn line_count(&self) -> usize

Source§

fn character(&self, idx: usize) -> Option<char>

Source§

fn len_before_line(&self, line: usize) -> usize

Implementors§