pub struct SecureTextEdit<'a> { /* private fields */ }Expand description
A widget for editing text.
This widget is identical to egui::TextEdit, but it uses a custom TextBuffer
that can take either a [SecureString] or a String.
To use it with a [SecureString], the feature secure-types must be enabled.
§Notes
- Accessability like screen readers is disabled to avoid multiple unsecure allocations of the entered text.
- If you want to make sure the text you enter doesn’t stay in memory in any way you have to set
Self::passwordtotrue.
Otherwise egui will make copies of that text and some of the copied allocations will stay in memory.
Implementations§
Source§impl<'a> SecureTextEdit<'a>
impl<'a> SecureTextEdit<'a>
Sourcepub fn singleline(text: &'a mut dyn TextBuffer) -> Self
pub fn singleline(text: &'a mut dyn TextBuffer) -> Self
Single-line field. Enter is consumed (see Self::return_key).
Sourcepub fn multiline(text: &'a mut dyn TextBuffer) -> Self
pub fn multiline(text: &'a mut dyn TextBuffer) -> Self
Multi-line field. Text wraps; Enter inserts a newline by default.
Sourcepub fn visuals(self, visuals: TextEditVisuals) -> Self
pub fn visuals(self, visuals: TextEditVisuals) -> Self
Override the chrome that would otherwise come from the installed theme.
Sourcepub fn id_source(self, id_source: impl Hash + Debug) -> Self
pub fn id_source(self, id_source: impl Hash + Debug) -> Self
Alias for Self::id_salt.
Sourcepub fn id_salt(self, id_salt: impl Hash + Debug) -> Self
pub fn id_salt(self, id_salt: impl Hash + Debug) -> Self
Extra id salt so two fields in the same Ui do not share state.
Sourcepub fn hint_text(self, hint_text: impl Into<WidgetText>) -> Self
pub fn hint_text(self, hint_text: impl Into<WidgetText>) -> Self
Placeholder shown when the buffer is empty.
Sourcepub fn font(self, font_selection: impl Into<FontSelection>) -> Self
pub fn font(self, font_selection: impl Into<FontSelection>) -> Self
Font used to lay out the text.
Sourcepub fn text_color(self, text_color: Color32) -> Self
pub fn text_color(self, text_color: Color32) -> Self
Override the text color.
Sourcepub fn text_color_opt(self, text_color: Option<Color32>) -> Self
pub fn text_color_opt(self, text_color: Option<Color32>) -> Self
Optional text color. None keeps the theme / style default.
Sourcepub fn password(self, password: bool) -> Self
pub fn password(self, password: bool) -> Self
Mask glyphs and skip extra copies of the buffer.
Required if you want the entered text not to linger in egui allocations.
Sourcepub fn interactive(self, interactive: bool) -> Self
pub fn interactive(self, interactive: bool) -> Self
If false, the field is painted but ignores input.
Sourcepub fn desired_width(self, desired_width: f32) -> Self
pub fn desired_width(self, desired_width: f32) -> Self
Preferred width. Defaults to egui::Spacing::text_edit_width.
Sourcepub fn desired_rows(self, desired_height_rows: usize) -> Self
pub fn desired_rows(self, desired_height_rows: usize) -> Self
Preferred height, in rows of text (multiline).
Sourcepub fn lock_focus(self, tab_will_indent: bool) -> Self
pub fn lock_focus(self, tab_will_indent: bool) -> Self
If true, Tab inserts a tab instead of moving focus.
Sourcepub fn cursor_at_end(self, b: bool) -> Self
pub fn cursor_at_end(self, b: bool) -> Self
Place the cursor at the end when the field first gains focus.
Sourcepub fn horizontal_align(self, align: Align) -> Self
pub fn horizontal_align(self, align: Align) -> Self
Horizontal alignment of the text inside the field.
Sourcepub fn vertical_align(self, align: Align) -> Self
pub fn vertical_align(self, align: Align) -> Self
Vertical alignment of the text inside the field.
Sourcepub fn clip_text(self, b: bool) -> Self
pub fn clip_text(self, b: bool) -> Self
Clip overflowing text in single-line mode. Ignored for multiline.
Sourcepub fn char_limit(self, limit: usize) -> Self
pub fn char_limit(self, limit: usize) -> Self
Maximum number of characters accepted.
Sourcepub fn return_key(self, return_key: impl Into<Option<KeyboardShortcut>>) -> Self
pub fn return_key(self, return_key: impl Into<Option<KeyboardShortcut>>) -> Self
Key that finishes editing on a single-line field. None disables it.
Sourcepub fn background_color(self, color: Color32) -> Self
pub fn background_color(self, color: Color32) -> Self
Override the background fill.
Sourcepub fn show(self, ui: &mut Ui) -> SecureTextEditOutput
pub fn show(self, ui: &mut Ui) -> SecureTextEditOutput
Paint the field and return the response plus updated cursor state.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for SecureTextEdit<'a>
impl<'a> !Send for SecureTextEdit<'a>
impl<'a> !Sync for SecureTextEdit<'a>
impl<'a> !UnwindSafe for SecureTextEdit<'a>
impl<'a> Freeze for SecureTextEdit<'a>
impl<'a> Unpin for SecureTextEdit<'a>
impl<'a> UnsafeUnpin for SecureTextEdit<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more