Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Use `SharedString` for `Label`s

Marshall Bowers2b53c6778986
diff --git a/crates/ui2/src/elements/label.rs b/crates/ui2/src/elements/label.rs
index edcc76665ad..accd9e2be55 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<S: 'static + Send + Sync + Clone> {
state_type: PhantomData<S>,
- label: String,
+ label: SharedString,
color: LabelColor,
size: LabelSize,
highlight_indices: Vec<usize>,
@@ -56,10 +56,7 @@ pub struct Label<S: 'static + Send + Sync + Clone> {
}
impl<S: 'static + Send + Sync + Clone> Label<S> {
- pub fn new<L>(label: L) -> Self
- where
- L: Into<String>,
- {
+ pub fn new(label: impl Into<SharedString>) -> Self {
Self {
state_type: PhantomData,
label: label.into(),
diff --git a/crates/ui2/src/prelude.rs b/crates/ui2/src/prelude.rs
index 4fddabe3a53..44ca262470b 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};