summaryrefslogtreecommitdiffstats
path: root/native/src/widget/text_input/value.rs
diff options
context:
space:
mode:
Diffstat (limited to 'native/src/widget/text_input/value.rs')
-rw-r--r--native/src/widget/text_input/value.rs9
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