From df712f9ccfddebafdc7a7f97953f7249176d28e7 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 17 Nov 2020 05:13:06 +0100 Subject: Implement flexible `TextInput::draw` helper --- native/src/widget/text_input/value.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'native/src/widget/text_input/value.rs') diff --git a/native/src/widget/text_input/value.rs b/native/src/widget/text_input/value.rs index 1e9ba45b..8df74e0c 100644 --- a/native/src/widget/text_input/value.rs +++ b/native/src/widget/text_input/value.rs @@ -21,6 +21,15 @@ impl Value { Self { graphemes } } + /// Returns whether the [`Value`] is empty or not. + /// + /// A [`Value`] is empty when it contains no graphemes. + /// + /// [`Value`]: struct.Value.html + pub fn is_empty(&self) -> bool { + self.len() == 0 + } + /// Returns the total amount of graphemes in the [`Value`]. /// /// [`Value`]: struct.Value.html -- cgit