feat(widget): add text function with Cow<str> input

This commit is contained in:
Michael Aaron Murphy 2023-01-23 22:48:06 +01:00 committed by Michael Murphy
parent f81a06bc4a
commit b3a3c9c29a
6 changed files with 37 additions and 14 deletions

14
src/widget/text.rs Normal file
View file

@ -0,0 +1,14 @@
use std::borrow::Cow;
pub use iced::widget::Text;
/// Creates a new [`Text`] widget with the provided content.
///
/// [`Text`]: widget::Text
pub fn text<'a, Renderer>(text: impl Into<Cow<'a, str>>) -> Text<'a, Renderer>
where
Renderer: iced_native::text::Renderer,
Renderer::Theme: iced::widget::text::StyleSheet,
{
Text::new(text)
}