From 2b53c6778986e0bb7dad1f98d7568ab61276cb8b Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Wed, 18 Oct 2023 10:58:50 -0400 Subject: [PATCH] Use `SharedString` for `Label`s --- crates/ui2/src/elements/label.rs | 7 ++----- crates/ui2/src/prelude.rs | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/crates/ui2/src/elements/label.rs b/crates/ui2/src/elements/label.rs index edcc76665ad6ee19c669e35719fa55542e711fe8..accd9e2be5571d6a52b3f68d9d1fa522467ed641 100644 --- a/crates/ui2/src/elements/label.rs +++ b/crates/ui2/src/elements/label.rs @@ -48,7 +48,7 @@ pub enum LabelSize { #[derive(Element, Clone)] pub struct Label { state_type: PhantomData, - label: String, + label: SharedString, color: LabelColor, size: LabelSize, highlight_indices: Vec, @@ -56,10 +56,7 @@ pub struct Label { } impl Label { - pub fn new(label: L) -> Self - where - L: Into, - { + pub fn new(label: impl Into) -> Self { Self { state_type: PhantomData, label: label.into(), diff --git a/crates/ui2/src/prelude.rs b/crates/ui2/src/prelude.rs index 4fddabe3a5365880e7ceef1efe2dc4566fa53cb6..44ca262470bd0de354a07f0323a94e37ee80b47e 100644 --- a/crates/ui2/src/prelude.rs +++ b/crates/ui2/src/prelude.rs @@ -1,6 +1,6 @@ pub use gpui3::{ - div, Click, Element, Hover, IntoAnyElement, ParentElement, ScrollState, Styled, ViewContext, - WindowContext, + div, Click, Element, Hover, IntoAnyElement, ParentElement, ScrollState, SharedString, Styled, + ViewContext, WindowContext, }; pub use crate::{theme, ButtonVariant, ElementExt, Theme};