diff options
Diffstat (limited to 'widget')
-rw-r--r-- | widget/src/helpers.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/widget/src/helpers.rs b/widget/src/helpers.rs index deff0261..5bfb590f 100644 --- a/widget/src/helpers.rs +++ b/widget/src/helpers.rs @@ -154,6 +154,19 @@ where Text::new(text) } +/// Creates a new [`Text`] widget that displays the provided value. +/// +/// [`Text`]: core::widget::Text +pub fn value<'a, Theme, Renderer>( + value: impl ToString, +) -> Text<'a, Theme, Renderer> +where + Theme: text::Catalog + 'a, + Renderer: core::text::Renderer, +{ + Text::new(value.to_string()) +} + /// Creates a new [`Checkbox`]. /// /// [`Checkbox`]: crate::Checkbox |