From 6e3393c93fd2fe49fe616e0fa20260c3324b11dd Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Wed, 18 Oct 2023 10:59:42 -0400 Subject: [PATCH] Use `SharedString` for `Button`s --- crates/ui2/src/elements/button.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/crates/ui2/src/elements/button.rs b/crates/ui2/src/elements/button.rs index 65f0db175a954142add1db868b51a751f599bced..ce7edd2a780bc450337a7389cb6dc33768a9c9b8 100644 --- a/crates/ui2/src/elements/button.rs +++ b/crates/ui2/src/elements/button.rs @@ -35,7 +35,7 @@ impl Default for ButtonHandlers { #[derive(Element)] pub struct Button { state_type: PhantomData, - label: String, + label: SharedString, variant: ButtonVariant, state: InteractionState, icon: Option, @@ -45,10 +45,7 @@ pub struct Button { } impl Button { - pub fn new(label: L) -> Self - where - L: Into, - { + pub fn new(label: impl Into) -> Self { Self { state_type: PhantomData, label: label.into(), @@ -61,10 +58,7 @@ impl Button { } } - pub fn ghost(label: L) -> Self - where - L: Into, - { + pub fn ghost(label: impl Into) -> Self { Self::new(label).variant(ButtonVariant::Ghost) }