Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Get cell compiling
Nathan Sobo4b2054215ac5
diff --git a/crates/gpui/src/elements/cell.rs b/crates/gpui/src/elements/cell.rsindex 43fb3a8e7fe..1115f799c3c 100644--- a/crates/gpui/src/elements/cell.rs+++ b/crates/gpui/src/elements/cell.rs@@ -4,55 +4,10 @@ struct Cell {}impl Cell {fn new(style: CellStyle) -> Self {- Self { style }+ Self {}}-- fn interactive(style: Interactive<CellStyle>) -> Self {}}-impl CellStyle {- fn interactive(self) -> Interactive<CellStyle> {- Interactive {- default: self.clone(),- hovered: self.clone(),- active: self.clone(),- disabled: self,- }- }-- fn hover(self, f: impl FnOnce(&mut CellStyle)) -> Interactive<CellStyle> {- let mut style = self.interactive();- f(&mut style.hovered);- style- }-}--fn foo() {-- struct WidgetStyle {- foo: CellStyle,- bar: CellStyle,- button: Interactive<CellStyle>,- }-- let mut header_style = CellStyle::default();- header_style.fill = Fill::Color(Color::red());-- let style = CellStyle::default().hover(|style| {-- })-- let interactive = style.hover(|style| {- style.fill = Fill::Color(Color::red());- });--- style.hover(|style| {- style- .fill(Color(red))- .text_color(Color(red));- })-}struct Interactive<Style> {default: Style,hovered: Style,@@ -85,6 +40,7 @@ struct CellStyle {shadows: Vec<Shadow>,}+#[derive(Clone, Default)]struct CornerRadii {top_left: f32,top_right: f32,@@ -92,11 +48,18 @@ struct CornerRadii {bottom_left: f32,}+#[derive(Clone)]enum Fill {Color(Color),- Svg(String),}+impl Default for Fill {+ fn default() -> Self {+ Fill::Color(Color::default())+ }+}++#[derive(Clone, Default)]struct Border {color: Color,width: f32,@@ -106,22 +69,35 @@ struct Border {right: bool,}+#[derive(Clone, Copy)]enum Length {Fixed(f32),Auto(f32),}+impl Default for Length {+ fn default() -> Self {+ Length::Auto(1.)+ }+}++#[derive(Clone, Copy, Default)]enum Axis {X,+ #[default]Y,Z,}+#[derive(Clone, Copy, Default)]enum Overflow {+ #[default]+ Visible,Hidden,Auto,}+#[derive(Clone, Copy)]enum Gap {Fixed(f32),Around,@@ -129,22 +105,33 @@ enum Gap {Even,}+impl Default for Gap {+ fn default() -> Self {+ Gap::Fixed(0.)+ }+}++#[derive(Clone, Copy, Default)]struct Shadow {offset: Vector2F,blur: f32,color: Color,}+#[derive(Clone, Copy, Default)]enum FontStyle {+ #[default]Normal,Italic,Oblique,}+#[derive(Clone, Copy, Default)]enum FontWeight {Thin,ExtraLight,Light,+ #[default]Normal,Medium,Semibold,