diff options
author | 2020-11-17 05:13:06 +0100 | |
---|---|---|
committer | 2020-11-17 05:13:06 +0100 | |
commit | df712f9ccfddebafdc7a7f97953f7249176d28e7 (patch) | |
tree | ef3150debd7e71e08fdf8c0893df28b4a3f3836f /native/src/widget/text_input/value.rs | |
parent | 62295f554b885b8d486b666bc10dc4ecdc78c7d6 (diff) | |
download | iced-df712f9ccfddebafdc7a7f97953f7249176d28e7.tar.gz iced-df712f9ccfddebafdc7a7f97953f7249176d28e7.tar.bz2 iced-df712f9ccfddebafdc7a7f97953f7249176d28e7.zip |
Implement flexible `TextInput::draw` helper
Diffstat (limited to 'native/src/widget/text_input/value.rs')
-rw-r--r-- | native/src/widget/text_input/value.rs | 9 |
1 files changed, 9 insertions, 0 deletions
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 |