gpui: Implement From<String> for ElementId (#44447)
Release Notes:
- N/A
## Before
```rs
div()
.id(SharedString::from(format!("process-entry-{ix}-command")))
```
## After
```rs
div()
.id(format!("process-entry-{ix}-command"))
```
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use gpui::{
|
||||
Application, Background, Bounds, ColorSpace, Context, MouseDownEvent, Path, PathBuilder,
|
||||
PathStyle, Pixels, Point, Render, SharedString, StrokeOptions, Window, WindowOptions, canvas,
|
||||
div, linear_color_stop, linear_gradient, point, prelude::*, px, quad, rgb, size,
|
||||
PathStyle, Pixels, Point, Render, StrokeOptions, Window, WindowOptions, canvas, div,
|
||||
linear_color_stop, linear_gradient, point, prelude::*, px, quad, rgb, size,
|
||||
};
|
||||
|
||||
struct PaintingViewer {
|
||||
@@ -309,7 +309,7 @@ fn button(
|
||||
on_click: impl Fn(&mut PaintingViewer, &mut Context<PaintingViewer>) + 'static,
|
||||
) -> impl IntoElement {
|
||||
div()
|
||||
.id(SharedString::from(text.to_string()))
|
||||
.id(text.to_string())
|
||||
.child(text.to_string())
|
||||
.bg(gpui::black())
|
||||
.text_color(gpui::white())
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use gpui::{
|
||||
App, Application, Bounds, Context, KeyBinding, PromptButton, PromptLevel, SharedString, Timer,
|
||||
Window, WindowBounds, WindowKind, WindowOptions, actions, div, prelude::*, px, rgb, size,
|
||||
App, Application, Bounds, Context, KeyBinding, PromptButton, PromptLevel, Timer, Window,
|
||||
WindowBounds, WindowKind, WindowOptions, actions, div, prelude::*, px, rgb, size,
|
||||
};
|
||||
|
||||
struct SubWindow {
|
||||
@@ -9,7 +9,7 @@ struct SubWindow {
|
||||
|
||||
fn button(text: &str, on_click: impl Fn(&mut Window, &mut App) + 'static) -> impl IntoElement {
|
||||
div()
|
||||
.id(SharedString::from(text.to_string()))
|
||||
.id(text.to_string())
|
||||
.flex_none()
|
||||
.px_2()
|
||||
.bg(rgb(0xf7f7f7))
|
||||
|
||||
Reference in New Issue
Block a user