Skip to main content

TextBuffer

Trait TextBuffer 

Source
pub trait TextBuffer {
    // Required methods
    fn is_secure(&self) -> bool;
    fn insert_text_at_char_idx(
        &mut self,
        char_idx: usize,
        text_to_insert: &str,
    ) -> usize;
    fn delete_text_char_range(&mut self, char_range: Range<usize>);
    fn char_len(&self) -> usize;
    fn to_string(&self) -> String;
}
Expand description

Buffer used by SecureTextEdit.

Implemented for String always, and for [secure_types::SecureString] when the secure-types feature is on. Secure buffers report TextBuffer::is_secure so the widget can avoid extra copies.

Required Methods§

Source

fn is_secure(&self) -> bool

true when the backing store should not be cloned into egui history.

Source

fn insert_text_at_char_idx( &mut self, char_idx: usize, text_to_insert: &str, ) -> usize

Insert text_to_insert at the given char index. Returns chars written.

Source

fn delete_text_char_range(&mut self, char_range: Range<usize>)

Delete the half-open char range.

Source

fn char_len(&self) -> usize

Number of Unicode scalar values.

Source

fn to_string(&self) -> String

Snapshot the contents. Prefer not calling this on a secure buffer.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl TextBuffer for String

Source§

fn is_secure(&self) -> bool

Source§

fn insert_text_at_char_idx( &mut self, char_idx: usize, text_to_insert: &str, ) -> usize

Source§

fn delete_text_char_range(&mut self, char_range: Range<usize>)

Source§

fn char_len(&self) -> usize

Source§

fn to_string(&self) -> String

Implementors§