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 `Button`s

Marshall Bowers6e3393c93fd2
diff --git a/crates/ui2/src/elements/button.rs b/crates/ui2/src/elements/button.rs
index 65f0db175a9..ce7edd2a780 100644
--- a/crates/ui2/src/elements/button.rs
+++ b/crates/ui2/src/elements/button.rs
@@ -35,7 +35,7 @@ impl<S: 'static + Send + Sync> Default for ButtonHandlers<S> {
#[derive(Element)]
pub struct Button<S: 'static + Send + Sync + Clone> {
state_type: PhantomData<S>,
- label: String,
+ label: SharedString,
variant: ButtonVariant,
state: InteractionState,
icon: Option<Icon>,
@@ -45,10 +45,7 @@ pub struct Button<S: 'static + Send + Sync + Clone> {
}
impl<S: 'static + Send + Sync + Clone> Button<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(),
@@ -61,10 +58,7 @@ impl<S: 'static + Send + Sync + Clone> Button<S> {
}
}
- pub fn ghost<L>(label: L) -> Self
- where
- L: Into<String>,
- {
+ pub fn ghost(label: impl Into<SharedString>) -> Self {
Self::new(label).variant(ButtonVariant::Ghost)
}