From 481fff7dee33ac13cfc54b4f5f3fcee06bb4f87d Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Thu, 7 Mar 2024 02:05:39 +0100 Subject: [PATCH] add `Text::new` --- hui/src/element/builtin/text.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hui/src/element/builtin/text.rs b/hui/src/element/builtin/text.rs index ffb00b1..3e760ff 100644 --- a/hui/src/element/builtin/text.rs +++ b/hui/src/element/builtin/text.rs @@ -57,6 +57,13 @@ impl Default for Text { } impl Text { + pub fn new(text: impl Into>) -> Self { + Self { + text: text.into(), + ..Default::default() + } + } + fn font(&self, f: FontHandle) -> FontHandle { self.font.unwrap_or(f) }